578 lines
32 KiB
ObjectPascal
578 lines
32 KiB
ObjectPascal
|
|
unit U_JGPBCKKCList_BengCheCXMgg;
|
|||
|
|
|
|||
|
|
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, cxNavigator, dxBarBuiltInMenu;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmJGPBCKKCList_BengCheCXMgg = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBFind: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
CDS_Main: TClientDataSet;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
RMDBMain: TRMDBDataSet;
|
|||
|
|
RMXLSExport1: TRMXLSExport;
|
|||
|
|
RMDBHZ: TRMDBDataSet;
|
|||
|
|
CDS_HZ: TClientDataSet;
|
|||
|
|
CDS_PRT: TClientDataSet;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
CheHao: TEdit;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
|
cxStyle1: TcxStyle;
|
|||
|
|
cxStyle2: TcxStyle;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
ADOQuery1: TADOQuery;
|
|||
|
|
cxStyle3: TcxStyle;
|
|||
|
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
|
TV1: TcxGridDBBandedTableView;
|
|||
|
|
V1CheHao: TcxGridDBBandedColumn;
|
|||
|
|
V1SJName: TcxGridDBBandedColumn;
|
|||
|
|
cxStyle4: TcxStyle;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
SJName: TEdit;
|
|||
|
|
V1Qty1: TcxGridDBBandedColumn;
|
|||
|
|
V1Column4: TcxGridDBBandedColumn;
|
|||
|
|
V1Column5: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty2: TcxGridDBBandedColumn;
|
|||
|
|
V1Price2: TcxGridDBBandedColumn;
|
|||
|
|
V1Money2: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty3: TcxGridDBBandedColumn;
|
|||
|
|
V1Price3: TcxGridDBBandedColumn;
|
|||
|
|
V1Money3: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty4: TcxGridDBBandedColumn;
|
|||
|
|
V1Price4: TcxGridDBBandedColumn;
|
|||
|
|
V1Money4: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty5: TcxGridDBBandedColumn;
|
|||
|
|
V1price5: TcxGridDBBandedColumn;
|
|||
|
|
V1Money5: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty6: TcxGridDBBandedColumn;
|
|||
|
|
V1price6: TcxGridDBBandedColumn;
|
|||
|
|
V1Money6: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty7: TcxGridDBBandedColumn;
|
|||
|
|
V1Price7: TcxGridDBBandedColumn;
|
|||
|
|
V1Money7: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty8: TcxGridDBBandedColumn;
|
|||
|
|
V1Price8: TcxGridDBBandedColumn;
|
|||
|
|
V1Money8: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty9: TcxGridDBBandedColumn;
|
|||
|
|
V1price9: TcxGridDBBandedColumn;
|
|||
|
|
V1Money9: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty10: TcxGridDBBandedColumn;
|
|||
|
|
V1Price10: TcxGridDBBandedColumn;
|
|||
|
|
V1Money10: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty11: TcxGridDBBandedColumn;
|
|||
|
|
V1Price11: TcxGridDBBandedColumn;
|
|||
|
|
V1Money11: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty12: TcxGridDBBandedColumn;
|
|||
|
|
V1Price12: TcxGridDBBandedColumn;
|
|||
|
|
V1Money12: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty13: TcxGridDBBandedColumn;
|
|||
|
|
V1Price13: TcxGridDBBandedColumn;
|
|||
|
|
V1Money13: TcxGridDBBandedColumn;
|
|||
|
|
V1ZCC: TcxGridDBBandedColumn;
|
|||
|
|
V1YFMoney: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty14: TcxGridDBBandedColumn;
|
|||
|
|
V1Price14: TcxGridDBBandedColumn;
|
|||
|
|
V1Money14: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty16: TcxGridDBBandedColumn;
|
|||
|
|
V1Price16: TcxGridDBBandedColumn;
|
|||
|
|
V1Money16: TcxGridDBBandedColumn;
|
|||
|
|
V1CE: TcxGridDBBandedColumn;
|
|||
|
|
V1Qty17: TcxGridDBBandedColumn;
|
|||
|
|
V1Price17: TcxGridDBBandedColumn;
|
|||
|
|
V1Money17: TcxGridDBBandedColumn;
|
|||
|
|
V1ZMoney: TcxGridDBBandedColumn;
|
|||
|
|
V1YHMoney: TcxGridDBBandedColumn;
|
|||
|
|
V1ZJMoney: TcxGridDBBandedColumn;
|
|||
|
|
TFHCX: TToolButton;
|
|||
|
|
TSPCX: TToolButton;
|
|||
|
|
RadioGroup1: TRadioGroup;
|
|||
|
|
THDWC: TToolButton;
|
|||
|
|
TCXHD: TToolButton;
|
|||
|
|
V1Ssel: TcxGridDBBandedColumn;
|
|||
|
|
cxTabControl1: TcxTabControl;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure ConNoMChange(Sender: TObject);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBFindClick(Sender: TObject);
|
|||
|
|
procedure MPRTCodeNameChange(Sender: TObject);
|
|||
|
|
procedure N1Click(Sender: TObject);
|
|||
|
|
procedure N2Click(Sender: TObject);
|
|||
|
|
procedure SXBatchNOChange(Sender: TObject);
|
|||
|
|
procedure FactoryNameChange(Sender: TObject);
|
|||
|
|
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure RadioGroup1Click(Sender: TObject);
|
|||
|
|
procedure TFHCXClick(Sender: TObject);
|
|||
|
|
procedure TSPCXClick(Sender: TObject);
|
|||
|
|
procedure THDWCClick(Sender: TObject);
|
|||
|
|
procedure TCXHDClick(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
procedure InitGrid();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmJGPBCKKCList_BengCheCXMgg: TfrmJGPBCKKCList_BengCheCXMgg;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
uses
|
|||
|
|
U_DataLink,U_RTFun,U_JGSXKNewList_CPCKCX,U_CLShuiPiao_CX;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmJGPBCKKCList_BengCheCXMgg:=nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.FormClose(Sender: TObject;
|
|||
|
|
var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action:=caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.InitGrid();
|
|||
|
|
begin
|
|||
|
|
ToolBar1.SetFocus;
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered:=False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
if RadioGroup1.ItemIndex=1 then
|
|||
|
|
begin
|
|||
|
|
sql.Add('select AA.*,CE=(ZMoney13-Money13),ZJMoney=YFMoney+isnull(Money14,0)+isnull(Money16,0)+isnull(Money17,0)+isnull(YHMoney,0),ZMoney=YFMoney+isnull(Money14,0)+isnull(Money16,0)+isnull(Money17,0) ');
|
|||
|
|
|
|||
|
|
sql.Add(' from (select A.CheHao,A.CLSpec,A.SJName,convert(varchar(7),A.CRTime,120) CRtime,Sum(CPFLQty) ZCC,Sum(YFMoney) YFMoney');
|
|||
|
|
sql.Add(',Qty1=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=5 and B.GLQty>=1)');
|
|||
|
|
sql.Add(',Price1=cast(1.4 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money1=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=5 and B.GLQty>=1)');
|
|||
|
|
sql.Add(',Qty2=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=7.5 and B.GLQty>=5.1)');
|
|||
|
|
sql.Add(',Price2=cast(1.5 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money2=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=7.5 and B.GLQty>=5.1)');
|
|||
|
|
sql.Add(',Qty3=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=10 and B.GLQty>=7.6)');
|
|||
|
|
sql.Add(',Price3=cast(1.6 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money3=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=10 and B.GLQty>=7.6)');
|
|||
|
|
sql.Add(',Qty4=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=12.5 and B.GLQty>=10.1)');
|
|||
|
|
sql.Add(',Price4=cast(1.7 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money4=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=12.5 and B.GLQty>=10.1)');
|
|||
|
|
sql.Add(',Qty5=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=15 and B.GLQty>=12.6)');
|
|||
|
|
sql.Add(',Price5=cast(1.8 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money5=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=15 and B.GLQty>=12.6)');
|
|||
|
|
sql.Add(',Qty6=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=17.5 and B.GLQty>=15.1)');
|
|||
|
|
sql.Add(',Price6=cast(1.9 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money6=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=17.5 and B.GLQty>=15.1)');
|
|||
|
|
sql.Add(',Qty7=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=20 and B.GLQty>=17.6)');
|
|||
|
|
sql.Add(',Price7=cast(2.0 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money7=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=20 and B.GLQty>=17.6)');
|
|||
|
|
sql.Add(',Qty8=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=22.5 and B.GLQty>=20.1)');
|
|||
|
|
sql.Add(',Price8=cast(2.15 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money8=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=22.5 and B.GLQty>=20.1)');
|
|||
|
|
sql.Add(',Qty9=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=25 and B.GLQty>=22.6)');
|
|||
|
|
sql.Add(',Price9=cast(2.3 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money9=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=25 and B.GLQty>=22.6)');
|
|||
|
|
sql.Add(',Qty10=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=27.5 and B.GLQty>=25.1)');
|
|||
|
|
sql.Add(',Price10=cast(2.45 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money10=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=27.5 and B.GLQty>=25.1)');
|
|||
|
|
sql.Add(',Qty11=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=30 and B.GLQty>=27.6)');
|
|||
|
|
sql.Add(',Price11=cast(2.6 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money11=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=30 and B.GLQty>=27.6)');
|
|||
|
|
sql.Add(',Qty12=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=32.5 and B.GLQty>=30.1)');
|
|||
|
|
sql.Add(',Price12=cast(2.75 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money12=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty<=32.5 and B.GLQty>=30.1)');
|
|||
|
|
sql.Add(',Qty13=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty>=32.6)');
|
|||
|
|
sql.Add(',Price13=cast(2.9 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money13=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty>=32.6)*2.9');
|
|||
|
|
sql.Add(',ZMoney13=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.GLQty>=32.6)');
|
|||
|
|
|
|||
|
|
sql.Add(',Qty14=Sum(CPFLQty)-1500');
|
|||
|
|
sql.Add(',Price14=cast(1 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money14=(case when Sum(CPFLQty)-1500>0 then Sum(CPFLQty)-1500 else 0 end)');
|
|||
|
|
sql.Add(',Qty16=(select Count(B.CPID) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.SJType=''ҹ<><D2B9>'')');
|
|||
|
|
sql.Add(',Price16=cast(15 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money16=(select Count(B.CPID) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120) and B.SJType=''ҹ<><D2B9>'')*15');
|
|||
|
|
|
|||
|
|
sql.Add(',Qty17=(select Sum(B.SPQty) from CL_SP_Main B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120))');
|
|||
|
|
sql.Add(',Price17=cast(20 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money17=(select Sum(B.SPQty) from CL_SP_Main B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120))*20');
|
|||
|
|
sql.Add(',YHMoney=(select Sum(B.SFMoney) from CL_YHKH B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(7),A.CRTime,120)=convert(varchar(7),B.CRTime,120))');
|
|||
|
|
sql.Add(' from CK_CP_CR A ');
|
|||
|
|
sql.Add('where A.CLSpec in (''15<31><35>'',''16<31><36>'',''17<31><37>'') ');
|
|||
|
|
if cxTabControl1.TabIndex=0 then
|
|||
|
|
sql.add('and isnull(A.HDStatus,'''')='''' ');
|
|||
|
|
if cxTabControl1.TabIndex=1 then
|
|||
|
|
sql.add('and isnull(A.HDStatus,'''')=''1'' ');
|
|||
|
|
sql.Add('and convert(varchar(7),A.CRTime,120)='''+trim(FormatDateTime('yyyy-MM',BegDate.date))+'''');
|
|||
|
|
sql.Add(' group by A.CheHao,A.CLSpec,A.SJName,convert(varchar(7),A.CRTime,120)) AA');
|
|||
|
|
sql.Add(' order by AA.SJName');
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add('select AA.*,CE=(ZMoney13-Money13),ZJMoney=YFMoney+isnull(Money14,0)+isnull(Money16,0)+isnull(Money17,0)+isnull(YHMoney,0),ZMoney=YFMoney+isnull(Money14,0)+isnull(Money16,0)+isnull(Money17,0) ');
|
|||
|
|
sql.Add(' from (select A.CheHao,A.CLSpec,A.SJName,convert(varchar(4),A.CRTime,120) CRtime,Sum(CPFLQty) ZCC,Sum(YFMoney) YFMoney');
|
|||
|
|
sql.Add(',Qty1=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=5 and B.GLQty>=1)');
|
|||
|
|
sql.Add(',Price1=cast(1.4 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money1=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=5 and B.GLQty>=1)');
|
|||
|
|
sql.Add(',Qty2=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=7.5 and B.GLQty>=5.1)');
|
|||
|
|
sql.Add(',Price2=cast(1.5 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money2=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=7.5 and B.GLQty>=5.1)');
|
|||
|
|
sql.Add(',Qty3=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=10 and B.GLQty>=7.6)');
|
|||
|
|
sql.Add(',Price3=cast(1.6 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money3=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=10 and B.GLQty>=7.6)');
|
|||
|
|
sql.Add(',Qty4=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=12.5 and B.GLQty>=10.1)');
|
|||
|
|
sql.Add(',Price4=cast(1.7 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money4=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=12.5 and B.GLQty>=10.1)');
|
|||
|
|
sql.Add(',Qty5=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=15 and B.GLQty>=12.6)');
|
|||
|
|
sql.Add(',Price5=cast(1.8 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money5=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=15 and B.GLQty>=12.6)');
|
|||
|
|
sql.Add(',Qty6=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=17.5 and B.GLQty>=15.1)');
|
|||
|
|
sql.Add(',Price6=cast(1.9 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money6=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=17.5 and B.GLQty>=15.1)');
|
|||
|
|
sql.Add(',Qty7=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=20 and B.GLQty>=17.6)');
|
|||
|
|
sql.Add(',Price7=cast(2.0 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money7=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=20 and B.GLQty>=17.6)');
|
|||
|
|
sql.Add(',Qty8=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=22.5 and B.GLQty>=20.1)');
|
|||
|
|
sql.Add(',Price8=cast(2.15 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money8=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=22.5 and B.GLQty>=20.1)');
|
|||
|
|
sql.Add(',Qty9=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=25 and B.GLQty>=22.6)');
|
|||
|
|
sql.Add(',Price9=cast(2.3 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money9=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=25 and B.GLQty>=22.6)');
|
|||
|
|
sql.Add(',Qty10=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=27.5 and B.GLQty>=25.1)');
|
|||
|
|
sql.Add(',Price10=cast(2.45 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money10=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=27.5 and B.GLQty>=25.1)');
|
|||
|
|
sql.Add(',Qty11=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=30 and B.GLQty>=27.6)');
|
|||
|
|
sql.Add(',Price11=cast(2.6 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money11=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=30 and B.GLQty>=27.6)');
|
|||
|
|
sql.Add(',Qty12=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=32.5 and B.GLQty>=30.1)');
|
|||
|
|
sql.Add(',Price12=cast(2.75 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money12=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty<=32.5 and B.GLQty>=30.1)');
|
|||
|
|
sql.Add(',Qty13=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty>=32.6)');
|
|||
|
|
sql.Add(',Price13=cast(2.9 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money13=(select Sum(CPFLQty) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty>=32.6)*2.9');
|
|||
|
|
sql.Add(',ZMoney13=(select Sum(B.YFMoney) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.GLQty>=32.6)');
|
|||
|
|
|
|||
|
|
sql.Add(',Qty14=Sum(CPFLQty)-1500');
|
|||
|
|
sql.Add(',Price14=cast(1 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money14=(case when Sum(CPFLQty)-1500>0 then Sum(CPFLQty)-1500 else 0 end)');
|
|||
|
|
sql.Add(',Qty16=(select Count(B.CPID) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.SJType=''ҹ<><D2B9>'')');
|
|||
|
|
sql.Add(',Price16=cast(10 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money16=(select Count(B.CPID) from CK_CP_CR B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120) and B.SJType=''ҹ<><D2B9>'')*10');
|
|||
|
|
|
|||
|
|
sql.Add(',Qty17=(select Sum(B.SPQty) from CL_SP_Main B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120))');
|
|||
|
|
sql.Add(',Price17=cast(20 as decimal(18,2))');
|
|||
|
|
sql.Add(',Money17=(select Sum(B.SPQty) from CL_SP_Main B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120))*20');
|
|||
|
|
sql.Add(',YHMoney=(select Sum(B.SFMoney) from CL_YHKH B where B.CheHao=A.CheHao and B.CLSpec=A.CLSpec and B.SJName=A.SJName and convert(varchar(4),A.CRTime,120)=convert(varchar(4),B.CRTime,120))');
|
|||
|
|
sql.Add(' from CK_CP_CR A ');
|
|||
|
|
sql.Add('where A.CLSpec in (''15<31><35>'',''16<31><36>'',''17<31><37>'') ');
|
|||
|
|
if cxTabControl1.TabIndex=0 then
|
|||
|
|
sql.add('and isnull(A.HDStatus,'''')='''' ');
|
|||
|
|
if cxTabControl1.TabIndex=1 then
|
|||
|
|
sql.add('and isnull(A.HDStatus,'''')=''1'' ');
|
|||
|
|
sql.Add('and convert(varchar(4),A.CRTime,120)='''+trim(FormatDateTime('yyyy',BegDate.date))+'''');
|
|||
|
|
sql.Add(' group by A.CheHao,A.CLSpec,A.SJName,convert(varchar(4),A.CRTime,120)) AA');
|
|||
|
|
sql.Add(' order by AA.SJName');
|
|||
|
|
end;
|
|||
|
|
//ShowMessage(SQL.Text);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_Main);
|
|||
|
|
finally;
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ToolBar1.SetFocus;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.ConNoMChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active then
|
|||
|
|
begin
|
|||
|
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxBandedGrid('<27><>ʻԱ<CABB><D4B1>ϸ12',Tv1,'ԭ<>ϲֿ<CFB2>');
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ReadCxBandedGrid('<27><>ʻԱ<CABB><D4B1>ϸ12',Tv1,'ԭ<>ϲֿ<CFB2>');
|
|||
|
|
BegDate.Date:=SGetServerDate(ADOQueryTemp);
|
|||
|
|
//InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.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 TfrmJGPBCKKCList_BengCheCXMgg.MPRTCodeNameChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBFind.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.N1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(CDS_Main,True);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.N2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(CDS_Main,False);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.SXBatchNOChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBFind.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.FactoryNameChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBFind.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
begin
|
|||
|
|
ModalResult:=1;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.ToolButton2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ToolBar1.SetFocus;
|
|||
|
|
if CDS_Main.IsEmpty then exit;
|
|||
|
|
TcxGridToExcel('<27><EFBFBD>ʻԱ<CABB><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',cxGrid2);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.RadioGroup1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.TFHCXClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Main.IsEmpty then exit;
|
|||
|
|
frmJGSXNewList_CPCKCX:=TfrmJGSXNewList_CPCKCX.Create(self);
|
|||
|
|
with frmJGSXNewList_CPCKCX do
|
|||
|
|
begin
|
|||
|
|
formid:='1';
|
|||
|
|
BegDate.Date:=StrToDate(trim(FormatDateTime('yyyy-MM',self.BegDate.Date)+'-01'));
|
|||
|
|
endDate.Date:=StrToDate(trim(FormatDateTime('yyyy-',self.BegDate.Date))+inttostr(StrToint(trim(FormatDateTime('MM',self.BegDate.Date)))+1)+'-01')-1;
|
|||
|
|
CLSpec.Text:=Trim(Self.CDS_Main.fieldbyname('CLSpec').AsString);
|
|||
|
|
CheHao.Text:=Trim(Self.CDS_Main.fieldbyname('CheHao').AsString);
|
|||
|
|
SJName.Text:=Trim(Self.CDS_Main.fieldbyname('SJName').AsString);
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.TSPCXClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Main.IsEmpty then exit;
|
|||
|
|
frmCLShuiPiao_CX:=TfrmCLShuiPiao_CX.Create(self);
|
|||
|
|
with frmCLShuiPiao_CX do
|
|||
|
|
begin
|
|||
|
|
formid:='1';
|
|||
|
|
BegDate.Date:=StrToDate(trim(FormatDateTime('yyyy-MM',self.BegDate.Date)+'-01'));
|
|||
|
|
endDate.Date:=StrToDate(trim(FormatDateTime('yyyy-',self.BegDate.Date))+inttostr(StrToint(trim(FormatDateTime('MM',self.BegDate.Date)))+1)+'-01')-1;
|
|||
|
|
CLSpec.Text:=Trim(Self.CDS_Main.fieldbyname('CLSpec').AsString);
|
|||
|
|
CheHao.Text:=Trim(Self.CDS_Main.fieldbyname('CheHao').AsString);
|
|||
|
|
SJName.Text:=Trim(Self.CDS_Main.fieldbyname('SJName').AsString);
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.THDWCClick(Sender: TObject);
|
|||
|
|
var maxno:string;
|
|||
|
|
begin
|
|||
|
|
if CDS_Main.IsEmpty then exit;
|
|||
|
|
if CDS_Main.Locate('Ssel',true,[])=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
with CDS_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if CDS_Main.FieldByName('Ssel').AsBoolean=true then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('update CK_CP_CR set HDStatus=''1'' ');
|
|||
|
|
sql.Add('where SJName='''+trim(CDS_Main.fieldbyname('SJName').AsString)+'''');
|
|||
|
|
SQL.Add(' and convert(varchar(7),CRTime,120)='''+trim(CDS_Main.fieldbyname('CRTime').AsString)+'''');
|
|||
|
|
sql.Add(' and (CLSpec=''16<31><36>'' or CLSpec=''17<31><37>'')');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from JSYGZHD_Year ');
|
|||
|
|
sql.Add('where SJName='''+trim(CDS_Main.fieldbyname('SJName').AsString)+'''');
|
|||
|
|
SQL.Add(' and HDMonth='''+trim(CDS_Main.fieldbyname('CRTime').AsString)+'''');
|
|||
|
|
sql.Add(' and CLSpec=''<27><><EFBFBD><EFBFBD>''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if IsEmpty then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryTemp,Maxno,'HD','JSYGZHD_Year',3,1)=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD>ʺ˶Ա<CBB6><D4B1><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
append;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
edit;
|
|||
|
|
maxno:=Trim(ADOQueryCmd.fieldbyname('HDID').AsString);
|
|||
|
|
end;
|
|||
|
|
FieldByName('HDID').Value:=Trim(maxno);
|
|||
|
|
FieldByName('CheHao').Value:=Trim(CDS_Main.fieldbyname('CheHao').AsString);
|
|||
|
|
FieldByName('CLSpec').Value:='<27><><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('SJName').Value:=Trim(CDS_Main.fieldbyname('SJName').AsString);
|
|||
|
|
FieldByName('HDMonth').Value:=Trim(CDS_Main.fieldbyname('CRtime').AsString);
|
|||
|
|
FieldByName('filler').Value:=Trim(DName);
|
|||
|
|
FieldByName('FLQty').Value:=CDS_Main.fieldbyname('ZCC').AsInteger;
|
|||
|
|
FieldByName('SPQty').Value:=CDS_Main.fieldbyname('Qty17').AsInteger;
|
|||
|
|
FieldByName('CCMoney').Value:=CDS_Main.fieldbyname('YFMoney').AsFloat;
|
|||
|
|
FieldByName('SPMoney').Value:=CDS_Main.fieldbyname('Money17').AsFloat;
|
|||
|
|
FieldByName('YHMoney').Value:=CDS_Main.fieldbyname('YHMoney').AsFloat;
|
|||
|
|
FieldByName('JJMoney').Value:=CDS_Main.fieldbyname('Money14').AsFloat+CDS_Main.fieldbyname('Money16').AsFloat;
|
|||
|
|
FieldByName('ZJMoney').Value:=CDS_Main.fieldbyname('ZJMoney').AsFloat;
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
CDS_Main.Delete;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>','<27><>ʾ');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.TCXHDClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Main.IsEmpty then exit;
|
|||
|
|
if CDS_Main.Locate('Ssel',true,[])=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
with CDS_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if CDS_Main.FieldByName('Ssel').AsBoolean=true then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('update CK_CP_CR set HDStatus='''' ');
|
|||
|
|
sql.Add('where SJName='''+trim(CDS_Main.fieldbyname('SJName').AsString)+'''');
|
|||
|
|
SQL.Add(' and convert(varchar(7),CRTime,120)='''+trim(CDS_Main.fieldbyname('CRtime').AsString)+'''');
|
|||
|
|
sql.Add(' and (CLSpec=''16<31><36>'' or CLSpec=''17<31><37>'')');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete from JSYGZHD_Year ');
|
|||
|
|
sql.Add('where SJName='''+trim(CDS_Main.fieldbyname('SJName').AsString)+'''');
|
|||
|
|
SQL.Add(' and HDMonth='''+trim(CDS_Main.fieldbyname('CRtime').AsString)+'''');
|
|||
|
|
sql.Add(' and CLSpec=''<27><><EFBFBD><EFBFBD>''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
CDS_Main.Delete;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>','<27><>ʾ');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGPBCKKCList_BengCheCXMgg.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
THDWC.Visible:=False;
|
|||
|
|
TCXHD.Visible:=false;
|
|||
|
|
if cxTabControl1.TabIndex=0 then
|
|||
|
|
begin
|
|||
|
|
THDWC.Visible:=true;
|
|||
|
|
end;
|
|||
|
|
if cxTabControl1.TabIndex=1 then
|
|||
|
|
begin
|
|||
|
|
TCXHD.Visible:=true;
|
|||
|
|
end;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|