423 lines
19 KiB
ObjectPascal
423 lines
19 KiB
ObjectPascal
|
|
unit U_BCHZ_Year_MX;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|||
|
|
cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView,
|
|||
|
|
cxGridBandedTableView, cxGridDBBandedTableView, cxGridLevel, cxClasses,
|
|||
|
|
cxControls, cxGridCustomView, cxGridDBTableView, cxGrid, StdCtrls, ComCtrls,
|
|||
|
|
ExtCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient,
|
|||
|
|
cxDropDownEdit, cxCheckBox, RM_Common, RM_Class, RM_e_Xls, RM_Dataset,
|
|||
|
|
RM_System, RM_GridReport, Menus, cxCalendar, cxButtonEdit, cxTextEdit, cxPC,
|
|||
|
|
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
|
|||
|
|
TfrmBCHZ_Year_MX = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBFind: TToolButton;
|
|||
|
|
TBExport: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
CDS_Main: TClientDataSet;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
RMDBMain: TRMDBDataSet;
|
|||
|
|
RMXLSExport1: TRMXLSExport;
|
|||
|
|
RMDBHZ: TRMDBDataSet;
|
|||
|
|
CDS_HZ: TClientDataSet;
|
|||
|
|
CDS_PRT: TClientDataSet;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
SJName: TEdit;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
CLSpec: TEdit;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
v1SJName: TcxGridDBColumn;
|
|||
|
|
v1CLSpec: TcxGridDBColumn;
|
|||
|
|
v1SanMonth: TcxGridDBColumn;
|
|||
|
|
v1CLName: TcxGridDBColumn;
|
|||
|
|
v1CPFLQty: TcxGridDBColumn;
|
|||
|
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
|
CLName: TEdit;
|
|||
|
|
v1PJMYLQty: TcxGridDBColumn;
|
|||
|
|
v1SiMonth: TcxGridDBColumn;
|
|||
|
|
v1WuMonth: TcxGridDBColumn;
|
|||
|
|
v1LiuMonth: TcxGridDBColumn;
|
|||
|
|
v1QiMonth: TcxGridDBColumn;
|
|||
|
|
v1BaMonth: TcxGridDBColumn;
|
|||
|
|
v1JiuMonth: TcxGridDBColumn;
|
|||
|
|
v1ShiMonth: TcxGridDBColumn;
|
|||
|
|
v1ShiYiMonth: TcxGridDBColumn;
|
|||
|
|
v1ShiErMonth: TcxGridDBColumn;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure ConNoMChange(Sender: TObject);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBExportClick(Sender: TObject);
|
|||
|
|
procedure TBFindClick(Sender: TObject);
|
|||
|
|
procedure N1Click(Sender: TObject);
|
|||
|
|
procedure N2Click(Sender: TObject);
|
|||
|
|
procedure SPIDChange(Sender: TObject);
|
|||
|
|
procedure SPSpecChange(Sender: TObject);
|
|||
|
|
procedure GCNameChange(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
private
|
|||
|
|
canshu1, canshu2, canshu3: string;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure setstatus();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmBCHZ_Year_MX: TfrmBCHZ_Year_MX;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_SXCKInPut, U_JGSXCKInPut, U_CLShuiPiao_Sub,
|
|||
|
|
U_CLYouliang_Sub, U_JBCHZ_MX;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
procedure TfrmBCHZ_Year_MX.setstatus();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmBCHZ_Year_MX := nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
//cxGrid1.Align:=alClient;
|
|||
|
|
BegDate.DateTime := SGetServerDate(ADOQueryCmd);
|
|||
|
|
canshu1 := Trim(DParameters1);
|
|||
|
|
canshu2 := Trim(DParameters2);
|
|||
|
|
canshu3 := Trim(DParameters3);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.InitGrid();
|
|||
|
|
begin
|
|||
|
|
Panel2.Visible := True;
|
|||
|
|
Panel2.Refresh;
|
|||
|
|
if v1PJMYLQty.Caption = '<27><>ƽ<EFBFBD><C6BD>ά<EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select A.CLName,A.CLSpec,A.SJName,Year(A.CRTime) CRTime,Sum(YCLMoney) CPFLQty');
|
|||
|
|
sql.Add(',PJMYLQty=(case when (Month(Max(A.CRTime))-2)>0 then Sum(YCLMoney)/(Month(Max(A.CRTime))-2) else 0 end)');
|
|||
|
|
sql.Add(',SanMonth=(select Sum(B.YCLMoney) from CK_YCLONE_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and B.YCLSpec=''<27><><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>''');
|
|||
|
|
SQL.Add(' and B.CRFlag=''<27><><EFBFBD><EFBFBD>'' and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=3)');
|
|||
|
|
sql.Add(',SiMonth=(select Sum(B.YCLMoney) from CK_YCLONE_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and B.YCLSpec=''<27><><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>''');
|
|||
|
|
SQL.Add(' and B.CRFlag=''<27><><EFBFBD><EFBFBD>'' and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=4)');
|
|||
|
|
sql.Add(',WuMonth=(select Sum(B.YCLMoney) from CK_YCLONE_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and B.YCLSpec=''<27><><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>''');
|
|||
|
|
SQL.Add(' and B.CRFlag=''<27><><EFBFBD><EFBFBD>'' and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=5)');
|
|||
|
|
sql.Add(',LiuMonth=(select Sum(B.YCLMoney) from CK_YCLONE_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and B.YCLSpec=''<27><><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>''');
|
|||
|
|
SQL.Add(' and B.CRFlag=''<27><><EFBFBD><EFBFBD>'' and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=6)');
|
|||
|
|
sql.Add(',QiMonth=(select Sum(B.YCLMoney) from CK_YCLONE_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and B.YCLSpec=''<27><><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>''');
|
|||
|
|
SQL.Add(' and B.CRFlag=''<27><><EFBFBD><EFBFBD>'' and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=7)');
|
|||
|
|
sql.Add(',BaMonth=(select Sum(B.YCLMoney) from CK_YCLONE_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and B.YCLSpec=''<27><><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>''');
|
|||
|
|
SQL.Add(' and B.CRFlag=''<27><><EFBFBD><EFBFBD>'' and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=8)');
|
|||
|
|
sql.Add(',JiuMonth=(select Sum(B.YCLMoney) from CK_YCLONE_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and B.YCLSpec=''<27><><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>''');
|
|||
|
|
SQL.Add(' and B.CRFlag=''<27><><EFBFBD><EFBFBD>'' and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=9)');
|
|||
|
|
sql.Add(',ShiMonth=(select Sum(B.YCLMoney) from CK_YCLONE_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and B.YCLSpec=''<27><><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>''');
|
|||
|
|
SQL.Add(' and B.CRFlag=''<27><><EFBFBD><EFBFBD>'' and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=10)');
|
|||
|
|
sql.Add(',ShiyiMonth=(select Sum(B.YCLMoney) from CK_YCLONE_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and B.YCLSpec=''<27><><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>''');
|
|||
|
|
SQL.Add(' and B.CRFlag=''<27><><EFBFBD><EFBFBD>'' and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=11)');
|
|||
|
|
sql.Add(',ShierMonth=(select Sum(B.YCLMoney) from CK_YCLONE_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and B.YCLSpec=''<27><><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>''');
|
|||
|
|
SQL.Add(' and B.CRFlag=''<27><><EFBFBD><EFBFBD>'' and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=12)');
|
|||
|
|
sql.Add(' from CK_YCLONE_CR A');
|
|||
|
|
sql.add(' where Year(A.CRTime)=''' + Trim(FormatDateTime('yyyy', BegDate.Date)) + ''' and Month(A.CRTime)>=3');
|
|||
|
|
SQL.Add(' and isnull(A.CLName,'''')=''<27>ó<EFBFBD>'' and A.YCLSpec=''<27><><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>'' and A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
sql.Add(' group by A.CLName,A.CLSpec,A.SJName,Year(A.CRTime)');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
|
end;
|
|||
|
|
if v1PJMYLQty.Caption = '<27><>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select A.CLName,A.CLSpec,A.SJName,Year(A.CRTime) CRTime,Sum(CPFLQty) CPFLQty');
|
|||
|
|
sql.Add(',PJMYLQty=(case when (Month(Max(A.CRTime))-2)>0 then Sum(CPFLQty)/(Month(Max(A.CRTime))-2) else 0 end)');
|
|||
|
|
sql.Add(',SanMonth=(select Sum(B.CPFLQty) from CK_CP_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=3)');
|
|||
|
|
sql.Add(',SiMonth=(select Sum(B.CPFLQty) from CK_CP_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=4)');
|
|||
|
|
sql.Add(',WuMonth=(select Sum(B.CPFLQty) from CK_CP_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=5)');
|
|||
|
|
sql.Add(',LiuMonth=(select Sum(B.CPFLQty) from CK_CP_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=6)');
|
|||
|
|
sql.Add(',QiMonth=(select Sum(B.CPFLQty) from CK_CP_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=7)');
|
|||
|
|
sql.Add(',BaMonth=(select Sum(B.CPFLQty) from CK_CP_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=8)');
|
|||
|
|
sql.Add(',JiuMonth=(select Sum(B.CPFLQty) from CK_CP_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=9)');
|
|||
|
|
sql.Add(',ShiMonth=(select Sum(B.CPFLQty) from CK_CP_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=10)');
|
|||
|
|
sql.Add(',ShiyiMonth=(select Sum(B.CPFLQty) from CK_CP_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=11)');
|
|||
|
|
sql.Add(',ShierMonth=(select Sum(B.CPFLQty) from CK_CP_CR B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=12)');
|
|||
|
|
sql.Add(' from CK_CP_CR A');
|
|||
|
|
sql.add(' where Year(A.CRTime)=''' + Trim(FormatDateTime('yyyy', BegDate.Date)) + '''');
|
|||
|
|
SQL.Add(' and isnull(A.CLName,'''')=''<27>ó<EFBFBD>'' and Month(A.CRTime)>=3');
|
|||
|
|
sql.Add(' group by A.CLName,A.CLSpec,A.SJName,Year(A.CRTime)');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
|
end;
|
|||
|
|
if v1PJMYLQty.Caption = '<27><>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select A.CLName,A.CLSpec,A.SJName,Year(A.CRTime) CRTime,Sum(CZMoney) CPFLQty');
|
|||
|
|
sql.Add(',PJMYLQty=(case when (Month(Max(A.CRTime))-2)>0 then Sum(CZMoney)/(Month(Max(A.CRTime))-2) else 0 end)');
|
|||
|
|
sql.Add(',SanMonth=(select Sum(B.CZMoney) from CL_YKYL_Main B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=3)');
|
|||
|
|
sql.Add(',SiMonth=(select Sum(B.CZMoney) from CL_YKYL_Main B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=4)');
|
|||
|
|
sql.Add(',WuMonth=(select Sum(B.CZMoney) from CL_YKYL_Main B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=5)');
|
|||
|
|
sql.Add(',LiuMonth=(select Sum(B.CZMoney) from CL_YKYL_Main B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=6)');
|
|||
|
|
sql.Add(',QiMonth=(select Sum(B.CZMoney) from CL_YKYL_Main B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=7)');
|
|||
|
|
sql.Add(',BaMonth=(select Sum(B.CZMoney) from CL_YKYL_Main B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=8)');
|
|||
|
|
sql.Add(',JiuMonth=(select Sum(B.CZMoney) from CL_YKYL_Main B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=9)');
|
|||
|
|
sql.Add(',ShiMonth=(select Sum(B.CZMoney) from CL_YKYL_Main B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=10)');
|
|||
|
|
sql.Add(',ShiyiMonth=(select Sum(B.CZMoney) from CL_YKYL_Main B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=11)');
|
|||
|
|
sql.Add(',ShierMonth=(select Sum(B.CZMoney) from CL_YKYL_Main B where isnull(B.SJName,'''')=isnull(A.SJName,'''') ');
|
|||
|
|
sql.Add(' and isnull(B.CLSpec,'''')=isnull(A.CLSpec,'''') and Year(B.CRTime)=Year(A.CRTime) and Month(B.CRTime)=12)');
|
|||
|
|
sql.Add(' from CL_YKYL_Main A');
|
|||
|
|
sql.add(' where Year(A.CRTime)=''' + Trim(FormatDateTime('yyyy', BegDate.Date)) + '''');
|
|||
|
|
SQL.Add(' and isnull(A.CLName,'''')=''<27>ó<EFBFBD>'' and Month(A.CRTime)>=3');
|
|||
|
|
sql.Add(' group by A.CLName,A.CLSpec,A.SJName,Year(A.CRTime)');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
|
end;
|
|||
|
|
Panel2.Visible := false;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
BegDate.SetFocus;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.ConNoMChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active then
|
|||
|
|
begin
|
|||
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>FM', Tv1, '<27><><EFBFBD><EFBFBD>');
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>FM', Tv1, '<27><><EFBFBD><EFBFBD>');
|
|||
|
|
//setstatus();
|
|||
|
|
//InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.TBExportClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
TcxGridToExcel('<27>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>', cxGrid2);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.TBFindClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active then
|
|||
|
|
begin
|
|||
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.N1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(CDS_Main, True);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.N2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(CDS_Main, False);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.SPIDChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
TBFind.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.SPSpecChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBFind.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.GCNameChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBFind.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
//setstatus();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmJJBCHZ_MX := TfrmJJBCHZ_MX.Create(self);
|
|||
|
|
with frmJJBCHZ_MX do
|
|||
|
|
begin
|
|||
|
|
frmBCHZ_Year_MX.Caption := '<27>ó<EFBFBD>ά<EFBFBD><CEAC><EFBFBD>·<EFBFBD><C2B7><EFBFBD>ϸ<EFBFBD><CFB8>ѯ';
|
|||
|
|
v1PJMYLQty.Caption := '<27><>ƽ<EFBFBD><C6BD>ά<EFBFBD><EFBFBD>';
|
|||
|
|
BegDate.Date := self.BegDate.Date;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBCHZ_Year_MX.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
frmJJBCHZ_MX := TfrmJJBCHZ_MX.Create(self);
|
|||
|
|
with frmJJBCHZ_MX do
|
|||
|
|
begin
|
|||
|
|
frmBCHZ_Year_MX.Caption := '<27>ó<EFBFBD>ά<EFBFBD><CEAC><EFBFBD>·<EFBFBD><C2B7><EFBFBD>ϸ<EFBFBD><CFB8>ѯ';
|
|||
|
|
v1PJMYLQty.Caption := '<27><>ƽ<EFBFBD><C6BD>ά<EFBFBD><EFBFBD>';
|
|||
|
|
BegDate.Date := self.BegDate.Date;
|
|||
|
|
if Self.Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName = 'SanMonth' then
|
|||
|
|
begin
|
|||
|
|
frmJJBCHZ_MX.cxTabControl1.TabIndex := 0;
|
|||
|
|
end
|
|||
|
|
else if Self.Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName = 'SiMonth' then
|
|||
|
|
begin
|
|||
|
|
frmJJBCHZ_MX.cxTabControl1.TabIndex := 1;
|
|||
|
|
end
|
|||
|
|
else if Self.Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName = 'WuMonth' then
|
|||
|
|
begin
|
|||
|
|
frmJJBCHZ_MX.cxTabControl1.TabIndex := 2;
|
|||
|
|
end
|
|||
|
|
else if Self.Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName = 'LiuMonth' then
|
|||
|
|
begin
|
|||
|
|
frmJJBCHZ_MX.cxTabControl1.TabIndex := 3;
|
|||
|
|
end
|
|||
|
|
else if Self.Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName = 'QiMonth' then
|
|||
|
|
begin
|
|||
|
|
frmJJBCHZ_MX.cxTabControl1.TabIndex := 4;
|
|||
|
|
end
|
|||
|
|
else if Self.Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName = 'BaMonth' then
|
|||
|
|
begin
|
|||
|
|
frmJJBCHZ_MX.cxTabControl1.TabIndex := 5;
|
|||
|
|
end
|
|||
|
|
else if Self.Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName = 'JiuMonth' then
|
|||
|
|
begin
|
|||
|
|
frmJJBCHZ_MX.cxTabControl1.TabIndex := 6;
|
|||
|
|
end
|
|||
|
|
else if Self.Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName = 'ShiMonth' then
|
|||
|
|
begin
|
|||
|
|
frmJJBCHZ_MX.cxTabControl1.TabIndex := 7;
|
|||
|
|
end
|
|||
|
|
else if Self.Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName = 'ShiYiMonth' then
|
|||
|
|
begin
|
|||
|
|
frmJJBCHZ_MX.cxTabControl1.TabIndex := 8;
|
|||
|
|
end
|
|||
|
|
else if Self.Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName = 'ShiErMonth' then
|
|||
|
|
begin
|
|||
|
|
frmJJBCHZ_MX.cxTabControl1.TabIndex := 9;
|
|||
|
|
end;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|