1433 lines
45 KiB
ObjectPascal
1433 lines
45 KiB
ObjectPascal
|
|
unit U_YSCR_SH;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
|||
|
|
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin,
|
|||
|
|
StdCtrls, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
|||
|
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
|||
|
|
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
|||
|
|
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
|||
|
|
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
|||
|
|
IdTCPClient, IdFTP,ShellAPI,IniFiles, cxCheckBox, cxCalendar,
|
|||
|
|
cxButtonEdit, cxTextEdit, cxPC, MovePanel;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmYSCR_SH = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
RMDB_Main: TRMDBDataSet;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
FactoryName: TEdit;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
begdate: TDateTimePicker;
|
|||
|
|
Enddate: TDateTimePicker;
|
|||
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
|
DS_HZ: TDataSource;
|
|||
|
|
CDS_HZ: TClientDataSet;
|
|||
|
|
P_CodeName: TEdit;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
P_Spec: TEdit;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
Edit1: TEdit;
|
|||
|
|
Button1: TButton;
|
|||
|
|
CheckBox1: TCheckBox;
|
|||
|
|
orderNo: TEdit;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
Tchk: TToolButton;
|
|||
|
|
Tnochk: TToolButton;
|
|||
|
|
cxTabControl1: TcxTabControl;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
prtColor: TEdit;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
Tv2: TcxGridDBTableView;
|
|||
|
|
v2Column5: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
|
v2Column6: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
|
v2PS: TcxGridDBColumn;
|
|||
|
|
v2MaoQty: TcxGridDBColumn;
|
|||
|
|
v2JZQty: TcxGridDBColumn;
|
|||
|
|
v2MQty: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn5: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn6: TcxGridDBColumn;
|
|||
|
|
v2Column1: TcxGridDBColumn;
|
|||
|
|
VBZ: TcxGridDBColumn;
|
|||
|
|
VUSDMoney: TcxGridDBColumn;
|
|||
|
|
VRMBMoney: TcxGridDBColumn;
|
|||
|
|
v2KP: TcxGridDBColumn;
|
|||
|
|
v2FeeType: TcxGridDBColumn;
|
|||
|
|
v2ConNoHZ: TcxGridDBColumn;
|
|||
|
|
VOrderNo: TcxGridDBColumn;
|
|||
|
|
v2P_CodeName: TcxGridDBColumn;
|
|||
|
|
v2Column4: TcxGridDBColumn;
|
|||
|
|
v2ComTaitou: TcxGridDBColumn;
|
|||
|
|
v2PRTColor: TcxGridDBColumn;
|
|||
|
|
v2PBNote: TcxGridDBColumn;
|
|||
|
|
v2Column2: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
FeeType: TEdit;
|
|||
|
|
Label15: TLabel;
|
|||
|
|
Price: TEdit;
|
|||
|
|
YFName: TComboBox;
|
|||
|
|
nochk: TToolButton;
|
|||
|
|
Label11: TLabel;
|
|||
|
|
ConNoHZ: TEdit;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
Label13: TLabel;
|
|||
|
|
Label14: TLabel;
|
|||
|
|
Label16: TLabel;
|
|||
|
|
ChkNote: TEdit;
|
|||
|
|
Label17: TLabel;
|
|||
|
|
TZZSH: TToolButton;
|
|||
|
|
TEJCX: TToolButton;
|
|||
|
|
Label18: TLabel;
|
|||
|
|
Label19: TLabel;
|
|||
|
|
v2Chkstatus: TcxGridDBColumn;
|
|||
|
|
v2KPType: TcxGridDBColumn;
|
|||
|
|
Label20: TLabel;
|
|||
|
|
Note: TEdit;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
v1ConNo: TcxGridDBColumn;
|
|||
|
|
v1PRTOrderQty: TcxGridDBColumn;
|
|||
|
|
v1OrderUnit: TcxGridDBColumn;
|
|||
|
|
v1DDTPPS: TcxGridDBColumn;
|
|||
|
|
v1DDTPQty: TcxGridDBColumn;
|
|||
|
|
v1PBCKDate: TcxGridDBColumn;
|
|||
|
|
v1DJCKPS: TcxGridDBColumn;
|
|||
|
|
v1DJCKQty: TcxGridDBColumn;
|
|||
|
|
v1PBSH: TcxGridDBColumn;
|
|||
|
|
v1HCDate: TcxGridDBColumn;
|
|||
|
|
v1JYPS: TcxGridDBColumn;
|
|||
|
|
v1sumJYQty: TcxGridDBColumn;
|
|||
|
|
v1JYDate: TcxGridDBColumn;
|
|||
|
|
v1JYSH: TcxGridDBColumn;
|
|||
|
|
v1CKDate: TcxGridDBColumn;
|
|||
|
|
v1CKPS: TcxGridDBColumn;
|
|||
|
|
v1SumCKQty: TcxGridDBColumn;
|
|||
|
|
v1CPKC: TcxGridDBColumn;
|
|||
|
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
CDS_Main: TClientDataSet;
|
|||
|
|
cxSplitter1: TcxSplitter;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
v1JYCPPS: TcxGridDBColumn;
|
|||
|
|
v1JYCPQty: TcxGridDBColumn;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure TBDelClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure FactoryNameChange(Sender: TObject);
|
|||
|
|
procedure Button2Click(Sender: TObject);
|
|||
|
|
procedure cxGridDBColumn8PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure cxGridDBColumn5PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure cxGridDBColumn1PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
|
procedure cxGridDBColumn3PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure cxGridDBColumn6PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure v2Column3PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure v2Column7PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure v2PSPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure v2Column2PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure v2KPMoneyPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure Button1Click(Sender: TObject);
|
|||
|
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure TchkClick(Sender: TObject);
|
|||
|
|
procedure TnochkClick(Sender: TObject);
|
|||
|
|
procedure nochkClick(Sender: TObject);
|
|||
|
|
procedure v2Column5PropertiesChange(Sender: TObject);
|
|||
|
|
procedure cxTabControl2Change(Sender: TObject);
|
|||
|
|
procedure TZZSHClick(Sender: TObject);
|
|||
|
|
procedure TEJCXClick(Sender: TObject);
|
|||
|
|
procedure Tv2StylesGetContentStyle(Sender: TcxCustomGridTableView;
|
|||
|
|
ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem;
|
|||
|
|
out AStyle: TcxStyle);
|
|||
|
|
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
procedure Tv2CellClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
private
|
|||
|
|
{ Private declarations }
|
|||
|
|
|
|||
|
|
procedure InitGridHZ();
|
|||
|
|
procedure InitGrid();
|
|||
|
|
function SaveData():Boolean;
|
|||
|
|
procedure SetStatus();
|
|||
|
|
|
|||
|
|
public
|
|||
|
|
canshu1,canshu2:string;
|
|||
|
|
fflag:integer;
|
|||
|
|
{ Public declarations }
|
|||
|
|
RKFlag,FCYID:String;
|
|||
|
|
fmanage:string;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmYSCR_SH: TfrmYSCR_SH;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
uses
|
|||
|
|
U_DataLink,U_Fun,U_ZDYHelp, U_ProductOrderNewList, U_ProductOrderList,
|
|||
|
|
U_ZdyAttachment, U_SXCKNewList,U_DJBCKKCList_DDSH;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
procedure TfrmYSCR_SH.SetStatus();
|
|||
|
|
var i:integer;
|
|||
|
|
begin
|
|||
|
|
Tchk.Visible:=false;
|
|||
|
|
TZZSH.Visible:=False;
|
|||
|
|
//TNOchk.Visible:=false;
|
|||
|
|
//Tejcx.Visible:=false;
|
|||
|
|
nochk.Visible:=false;
|
|||
|
|
if canshu1='<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
begin
|
|||
|
|
if cxtabcontrol1.TabIndex=0 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
if cxtabcontrol1.TabIndex=1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
if cxtabcontrol1.TabIndex=2 then
|
|||
|
|
begin
|
|||
|
|
tzzsh.Visible:=true;
|
|||
|
|
nochk.Visible:=true;
|
|||
|
|
end;
|
|||
|
|
if cxtabcontrol1.TabIndex=3 then
|
|||
|
|
begin
|
|||
|
|
nochk.Visible:=true;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
if cxtabcontrol1.TabIndex=1 then
|
|||
|
|
begin
|
|||
|
|
nochk.Visible:=true;
|
|||
|
|
Tchk.Visible:=true;
|
|||
|
|
end;
|
|||
|
|
if cxtabcontrol1.TabIndex=2 then
|
|||
|
|
begin
|
|||
|
|
nochk.Visible:=true;
|
|||
|
|
end;
|
|||
|
|
if cxtabcontrol1.TabIndex=3 then
|
|||
|
|
begin
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.InitGrid();
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered:=False;
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select isnull(isnull(E.PrtCodeName,A.P_CodeName),D.MPrtCodeName) P_CodeName,');
|
|||
|
|
sql.add('RMBMoney=(case when (A.BZType<>''$'') and (A.BZType<>''USD'') then Money else 0 end)');
|
|||
|
|
sql.add(',USDMoney=(case when (A.BZType<>''<27><>'') and (A.BZType<>''RMB'') then Money else 0 end)');
|
|||
|
|
sql.add(',ConNoHZ=isnull(F.ConNo,A.ConNO),isnull(isnull(E.prtspec,A.P_Spec),D.MPRTSpec) P_Spec,');
|
|||
|
|
sql.add('isnull(A.OrderNo,D.OrderNo) OrderNo,KPStatusH=(case when isnull(KPstatus,'''')='''' then ''δ<><CEB4>Ʊ'' else ''<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>'' end),');
|
|||
|
|
sql.add('E.PRTColor,E.SOrdDefStr4,');
|
|||
|
|
sql.add('HTType=(isnull((select Top 1 M.MPRTType from JYOrder_ConORD Q ');
|
|||
|
|
sql.add(' inner join JYOrderCon_Main M on Q.ConMainid=M.Mainid where Q.Mainid=A.Mainid),F.MPRTType))');
|
|||
|
|
sql.Add(',SCOrderNO=(select Top 1 JM.ConNo from Cloth_Main JM where JM.Mainid=A.Mainid)');
|
|||
|
|
sql.add(',isnull(A.Price,E.PrtPrice) Price');
|
|||
|
|
sql.add(',A.* ');
|
|||
|
|
sql.Add(' from YF_Money_CR A');
|
|||
|
|
sql.add(' left join JYOrder_Main D on D.Mainid=A.Mainid');
|
|||
|
|
sql.add(' left join JYOrderCon_Sub E on E.Subid=A.Conid');
|
|||
|
|
SQL.ADD(' Left join JYOrderCon_Main F on F.Mainid=E.Mainid');
|
|||
|
|
sql.Add(' where A.CRTime>='''+FormatDateTime('yyyy-MM-dd',begdate.DateTime)+''' ');
|
|||
|
|
sql.Add(' and A.CRTime<'''+FormatDateTime('yyyy-MM-dd',Enddate.DateTime+1)+''' ');
|
|||
|
|
sql.Add(' and A.CRType=''Ӧ<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>'' ');
|
|||
|
|
sql.add(' and (A.YFName=''<27><>Ʒ<EFBFBD><C6B7><EFBFBD>۽<EFBFBD><DBBD><EFBFBD>'' or Isnull(A.FeeType,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'')');
|
|||
|
|
IF cxTabControl1.TabIndex=0 then
|
|||
|
|
sql.Add(' and (A.status=''0'' or A.Chkstatus=''<27><>ͨ<EFBFBD><CDA8>'') ');
|
|||
|
|
IF cxTabControl1.TabIndex=1 then
|
|||
|
|
sql.Add(' and A.status=''1'' ');
|
|||
|
|
IF cxTabControl1.TabIndex=2 then
|
|||
|
|
sql.Add(' and A.status=''2'' ');
|
|||
|
|
IF cxTabControl1.TabIndex=3 then
|
|||
|
|
sql.Add(' and A.status=''3'' ');
|
|||
|
|
sql.add(' order by A.CRTime,F.ConNo,E.XHNO');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
|||
|
|
Label14.Caption:='0';
|
|||
|
|
Label16.Caption:='0';
|
|||
|
|
Label19.Caption:='0';
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
//ToolButton2.Click;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.InitGridHZ();
|
|||
|
|
begin
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmYSCR_SH:=nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action:=caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid('Ӧ<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>20',Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
{with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('delete CK_YP_CR where isnull(CRTime,'''')='''' and CYID='''+Trim(FCYID)+''' and CRType='''+Trim(RKFlag)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;}
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
procedure TfrmYSCR_SH.TBDelClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
FBBMoney,CRID:string;
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.IsEmpty then Exit;
|
|||
|
|
|
|||
|
|
|
|||
|
|
if CDS_HZ.Locate('ssel',true,[])=false then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
IF Fieldbyname('ssel').AsBoolean=true then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete YF_Money_CR where YFID='''+Trim(CDS_HZ.fieldbyname('YFID').AsString)+'''');
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
First;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
InitGrid();
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ReadCxGrid('Ӧ<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>20',Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
Enddate.DateTime:=SGetServerDate(ADOQueryTemp);
|
|||
|
|
begdate.DateTime:=SGetServerDate(ADOQueryTemp)-7;
|
|||
|
|
{ if Trim(DParameters7)<>'ƥ<><C6A5>' then
|
|||
|
|
begin
|
|||
|
|
v2PS.Hidden:=True;
|
|||
|
|
v2PS.Visible:=False;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
v2PS.Hidden:=False;
|
|||
|
|
v2PS.Visible:=True;
|
|||
|
|
end; }
|
|||
|
|
SetStatus();
|
|||
|
|
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
begdate.SetFocus;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.ToolButton2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Label14.Caption:='0';
|
|||
|
|
Label16.Caption:='0';
|
|||
|
|
Label19.Caption:='0';
|
|||
|
|
if ADOQueryMain.Active then
|
|||
|
|
begin
|
|||
|
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.FactoryNameChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ToolButton2.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.Button2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.IsEmpty then Exit;
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
|
if Trim(CDS_HZ.fieldbyname('SubID').AsString)<>'' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('delete YCL_SG_HZ where SubID='''+Trim(CDS_HZ.fieldbyname('SubID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_HZ.Delete;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmYSCR_SH.SaveData():Boolean;
|
|||
|
|
var
|
|||
|
|
maxId,CRID:String;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
if GetLSNo(ADOQueryCmd,maxId,'YS','YF_Money_CR',4,1)=False then
|
|||
|
|
begin
|
|||
|
|
Result:=False;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from YF_Money_KC where FactoryName='''+Trim(CDS_HZ.fieldbyname('FactoryName').AsString)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryCmd.IsEmpty=False then
|
|||
|
|
begin
|
|||
|
|
CRID:=ADOQueryCmd.fieldbyname('CRID').AsString;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update YF_Money_CRID set CRID=CRID+1');
|
|||
|
|
sql.Add('select * from YF_Money_CRID ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
CRID:=ADOQueryCmd.fieldbyname('CRID').AsString;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from YF_Money_KC where 1<>1');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('CRID').Value:=StrToInt(CRID);
|
|||
|
|
FieldByName('FactoryNo').Value:=Trim(CDS_HZ.fieldbyname('FactoryNo').AsString);
|
|||
|
|
FieldByName('FactoryName').Value:=Trim(CDS_HZ.fieldbyname('FactoryName').AsString);
|
|||
|
|
FieldByName('ZdyStr1').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
|
// FieldByName('YFDefFlag1').Value:=fFlag;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from YF_Money_CR where 1<>1');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('YFID').Value:=Trim(maxId);
|
|||
|
|
FieldByName('CRID').Value:=StrToInt(CRID);
|
|||
|
|
//SSetSaveDataCDSNew(ADOQueryCmd,Tv2,CDS_HZ,'YF_Money_CR',3);
|
|||
|
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
|
FieldByName('CRType').Value:='Ӧ<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>';
|
|||
|
|
FieldByName('CRFlag').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('QtyFlag').Value:=1;
|
|||
|
|
FieldByName('FactoryNo').Value:=Trim(CDS_HZ.fieldbyname('FactoryNo').AsString);
|
|||
|
|
FieldByName('FactoryName').Value:=Trim(CDS_HZ.fieldbyname('FactoryName').AsString);
|
|||
|
|
FieldByName('CRTime').Value:=SGetServerDate(ADOQueryTemp);
|
|||
|
|
FieldByName('YFDefFlag1').Value:=fFlag;
|
|||
|
|
FieldByName('status').Value:='0';
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('YFId').Value:=Trim(maxId);
|
|||
|
|
FieldByName('CRID').Value:=StrToInt(CRID);
|
|||
|
|
end;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
Result:=True;
|
|||
|
|
except
|
|||
|
|
Result:=True;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.cxGridDBColumn8PropertiesEditValueChanged(
|
|||
|
|
Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue,FFieldName:String;
|
|||
|
|
begin
|
|||
|
|
mvalue:=TcxTextEdit(Sender).EditingText;
|
|||
|
|
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName(FFieldName).Value:=Trim(mvalue);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate YCL_SG_HZ ');
|
|||
|
|
if Trim(mvalue)<>'' then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' Set '+FFieldName+'='''+Trim(mvalue)+'''');
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
sql.Add(' Set '+FFieldName+'=NULL');
|
|||
|
|
end;
|
|||
|
|
SQL.Add(',Editer='''+Trim(DName)+'''');
|
|||
|
|
SQL.Add(',Edittime=getdate() ');
|
|||
|
|
SQL.Add(' where SubId='''+Trim(CDS_HZ.fieldbyname('SubId').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.cxGridDBColumn5PropertiesEditValueChanged(
|
|||
|
|
Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue,FQty,FPrice,FMoney,FHuiLv,FBBMoney,FKCBB,FFieldName:String;
|
|||
|
|
begin
|
|||
|
|
{if Trim(CDS_HZ.fieldbyname('YFType').AsString)<>'' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܸ<EFBFBD><DCB8><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end; }
|
|||
|
|
mvalue:=TcxTextEdit(Sender).EditingText;
|
|||
|
|
if Trim(mvalue)='' then
|
|||
|
|
begin
|
|||
|
|
mvalue:='0';
|
|||
|
|
end;
|
|||
|
|
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName(FFieldName).Value:=Trim(mvalue);
|
|||
|
|
if Trim(DParameters2)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
FieldByName('HuiLv').Value:=1;
|
|||
|
|
end;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select isnull(BBMoney,0) BBMoney from YF_Money_CR where YFID='''+cds_hz.fieldbyname('YFID').AsString+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
FKCBB:=ADOQueryTemp.fieldbyname('BBMoney').AsString;
|
|||
|
|
|
|||
|
|
FQty:=Trim(CDS_HZ.fieldbyname('Qty').AsString);
|
|||
|
|
if Trim(FQty)='' then FQty:='0';
|
|||
|
|
|
|||
|
|
FPrice:=Trim(CDS_HZ.fieldbyname('Price').AsString);
|
|||
|
|
if Trim(FPrice)='' then FPrice:='0';
|
|||
|
|
FQty:=Trim(CDS_HZ.fieldbyname('Qty').AsString);
|
|||
|
|
if Trim(FQty)='' then FQty:='0';
|
|||
|
|
|
|||
|
|
FMoney:=Trim(CDS_HZ.fieldbyname('Money').AsString);
|
|||
|
|
if Trim(FMoney)='' then FMoney:='0';
|
|||
|
|
|
|||
|
|
FHuiLv:=Trim(CDS_HZ.fieldbyname('HuiLv').AsString);
|
|||
|
|
if Trim(FHuiLv)='' then FHuiLv:='0';
|
|||
|
|
|
|||
|
|
{FBBMoney:=Trim(CDS_HZ.fieldbyname('BBMoney').AsString);
|
|||
|
|
if Trim(FBBMoney)='' then FBBMoney:='0'; }
|
|||
|
|
|
|||
|
|
if Trim(FFieldName)<>'Money' then
|
|||
|
|
begin
|
|||
|
|
if Trim(FFieldName)<>'HuiLv' then
|
|||
|
|
begin
|
|||
|
|
FBBMoney:=FloatToStr(StrToFloat(FQty)*StrToFloat(FPrice)*StrToFloat(FHuiLv));
|
|||
|
|
FMoney:=FloatToStr(StrToFloat(FQty)*StrToFloat(FPrice));
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
FBBMoney:=FloatToStr(StrToFloat(FMoney)*StrToFloat(FHuiLv));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
FBBMoney:=FloatToStr(StrToFloat(FMoney)*StrToFloat(FHuiLv));
|
|||
|
|
end;
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('Money').Value:=StrToFloat(FMoney);
|
|||
|
|
FieldByName('BBMoney').Value:=StrToFloat(FBBMoney);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate YF_Money_CR ');
|
|||
|
|
sql.Add(' Set '+FFieldName+'='+Trim(mvalue));
|
|||
|
|
if Trim(FFieldName)<>'Money' then
|
|||
|
|
begin
|
|||
|
|
sql.Add(',Money='+FMoney);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
sql.Add(',BBMoney='+FBBMoney);
|
|||
|
|
SQL.Add(',Editer='''+Trim(DName)+'''');
|
|||
|
|
SQL.Add(',Edittime=getdate() ');
|
|||
|
|
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
|||
|
|
|
|||
|
|
SQL.Add('Update YF_Money_KC Set KCBBMoney=KCBBMoney-'+FKCBB+'+'+FBBMoney);
|
|||
|
|
sql.Add(' where CRID='''+Trim(CDS_HZ.fieldbyname('CRID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
tv2.Controller.EditingController.ShowEdit();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.cxGridDBColumn1PropertiesEditValueChanged(
|
|||
|
|
Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue,FFieldName:String;
|
|||
|
|
begin
|
|||
|
|
{if Trim(CDS_HZ.fieldbyname('YFType').AsString)<>'' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܸ<EFBFBD><DCB8><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end; }
|
|||
|
|
mvalue:=TcxTextEdit(Sender).EditingText;
|
|||
|
|
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName(FFieldName).Value:=Trim(mvalue);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate YF_Money_CR ');
|
|||
|
|
if Trim(mvalue)<>'' then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' Set '+FFieldName+'='''+Trim(mvalue)+'''');
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
sql.Add(' Set '+FFieldName+'=NULL');
|
|||
|
|
end;
|
|||
|
|
SQL.Add(',Editer='''+Trim(DName)+'''');
|
|||
|
|
SQL.Add(',Edittime=getdate() ');
|
|||
|
|
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.ToolButton3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZdyAttachment:=TfrmZdyAttachment.Create(Application);
|
|||
|
|
with frmZdyAttachment do
|
|||
|
|
begin
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('FactoryNo').Value:=Trim(CDS_HZ.fieldbyname('ZdyCode').AsString);
|
|||
|
|
FieldByName('FactoryName').Value:=Trim(CDS_HZ.fieldbyname('ZdyName').AsString);
|
|||
|
|
FieldByName('CRTime').Value:=SGetServerDate(ADOQueryTemp);
|
|||
|
|
FieldByName('HuiLv').Value:=1;
|
|||
|
|
if Trim(DParameters2)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
FieldByName('HuiLv').Value:=1;
|
|||
|
|
end;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
Self.SaveData();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZdyAttachment.Free;
|
|||
|
|
end;
|
|||
|
|
{ try
|
|||
|
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag:='CustomerNoName';
|
|||
|
|
flagname:='<27>Է<EFBFBD><D4B7><EFBFBD>λ';
|
|||
|
|
if Trim(DParameters4)='<27>Է<EFBFBD><D4B7><EFBFBD>λ<EFBFBD>ֿ<EFBFBD>' then
|
|||
|
|
MainType:='<27>տ<EFBFBD>';
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('FactoryNo').Value:=Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString);
|
|||
|
|
FieldByName('FactoryName').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
FieldByName('CRTime').Value:=SGetServerDate(ADOQueryTemp);
|
|||
|
|
if Trim(DParameters2)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
FieldByName('HuiLv').Value:=1;
|
|||
|
|
end;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
Self.SaveData();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end; }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.cxGridDBColumn3PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
if Trim(CDS_HZ.fieldbyname('YFType').AsString)<>'' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܸ<EFBFBD><DCB8><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag:='YFName';
|
|||
|
|
flagname:='<27><>Ŀ<EFBFBD><C4BF>ժҪ';
|
|||
|
|
if Trim(DParameters3)='<27><>Ŀ<EFBFBD>ֿ<EFBFBD>' then
|
|||
|
|
MainType:='<27>տ<EFBFBD>';
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('YFCode').Value:=Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString);
|
|||
|
|
FieldByName('YFName').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate YF_Money_CR ');
|
|||
|
|
sql.Add(' Set YFCode='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
|
|||
|
|
sql.Add(' ,YFName='''+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
|||
|
|
SQL.Add(',Editer='''+Trim(DName)+'''');
|
|||
|
|
SQL.Add(',Edittime=getdate() ');
|
|||
|
|
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.cxGridDBColumn6PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
if Trim(CDS_HZ.fieldbyname('YFType').AsString)<>'' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܸ<EFBFBD><DCB8><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag:='OrderUnit';
|
|||
|
|
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
Self.CDS_HZ.Edit;
|
|||
|
|
Self.CDS_HZ.FieldByName('QtyUnit').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate YF_Money_CR ');
|
|||
|
|
sql.Add(' Set QtyUnit='''+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
|||
|
|
SQL.Add(',Editer='''+Trim(DName)+'''');
|
|||
|
|
SQL.Add(',Edittime=getdate() ');
|
|||
|
|
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.v2Column3PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
if Trim(CDS_HZ.fieldbyname('YFType').AsString)<>'' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ܸ<EFBFBD><DCB8><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag:='BZType';
|
|||
|
|
flagname:='<27><><EFBFBD><EFBFBD>';
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
Self.CDS_HZ.Edit;
|
|||
|
|
Self.CDS_HZ.FieldByName('BZType').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate YF_Money_CR ');
|
|||
|
|
sql.Add(' Set BZType='''+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
|||
|
|
SQL.Add(',Editer='''+Trim(DName)+'''');
|
|||
|
|
SQL.Add(',Edittime=getdate() ');
|
|||
|
|
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.IsEmpty then Exit;
|
|||
|
|
SelExportData(Tv2,ADOQueryMain,'Ӧ<>տ<EFBFBD><D5BF>б<EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.v2Column7PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
if Trim(CDS_HZ.fieldbyname('YFType').AsString)<>'' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
frmProductOrderNewList:=TfrmProductOrderNewList.Create(Application);
|
|||
|
|
with frmProductOrderNewList do
|
|||
|
|
begin
|
|||
|
|
DParameters1:='<27><>Ȩ<EFBFBD><C8A8>';
|
|||
|
|
if fflag=2 then
|
|||
|
|
fsyrName:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD>';
|
|||
|
|
//frmProductOrderList.v1Column4.Visible:=True;
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
// FieldByName('MainId').Value:=Trim(frmProductOrderNewList.Order_Main.fieldbyname('MainId').AsString);
|
|||
|
|
// FieldByName('subID').Value:=Trim(frmProductOrderNewList.Order_Main.fieldbyname('subID').AsString);
|
|||
|
|
FieldByName('OrderNo').Value:=Trim(frmProductOrderNewList.Order_Main.fieldbyname('OrderNo').AsString);
|
|||
|
|
FieldByName('PRTCodeName').Value:=Trim(frmProductOrderNewList.Order_Main.fieldbyname('PRTCodeName').AsString);
|
|||
|
|
FieldByName('PRTColor').Value:=Trim(frmProductOrderNewList.Order_Main.fieldbyname('PRTColor').AsString);
|
|||
|
|
// FieldByName('Filler').Value:=Trim(frmProductOrderNewList.Order_Main.fieldbyname('Filler').AsString);
|
|||
|
|
post;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate YF_Money_CR ');
|
|||
|
|
sql.Add(' Set MainId='''+Trim(SELF.CDS_HZ.fieldbyname('MainId').AsString)+'''');
|
|||
|
|
sql.Add(' ,SubId='''+Trim(SELF.CDS_HZ.fieldbyname('SubId').AsString)+'''');
|
|||
|
|
sql.Add(' ,p_CodeName='''+Trim(SELF.CDS_HZ.fieldbyname('PRTCodeName').AsString)+'''');
|
|||
|
|
sql.Add(' ,p_Color='''+Trim(SELF.CDS_HZ.fieldbyname('PRTColor').AsString)+'''');
|
|||
|
|
SQL.Add(',Editer='''+Trim(DName)+'''');
|
|||
|
|
SQL.Add(',Edittime=getdate() ');
|
|||
|
|
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmProductOrderNewList.Free;
|
|||
|
|
self.Tv2.Controller.EditingController.ShowEdit();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.v2PSPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue,FFieldName:String;
|
|||
|
|
begin
|
|||
|
|
mvalue:=TcxTextEdit(Sender).EditingText;
|
|||
|
|
if Trim(mvalue)='' then
|
|||
|
|
begin
|
|||
|
|
mvalue:='0';
|
|||
|
|
end;
|
|||
|
|
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName(FFieldName).Value:=Trim(mvalue);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate YF_Money_CR ');
|
|||
|
|
sql.Add(' Set '+FFieldName+'='+Trim(mvalue));
|
|||
|
|
SQL.Add(',Editer='''+Trim(DName)+'''');
|
|||
|
|
SQL.Add(',Edittime=getdate() ');
|
|||
|
|
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.v2Column2PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue,FFieldName:String;
|
|||
|
|
begin
|
|||
|
|
mvalue:=TcxTextEdit(Sender).EditingText;
|
|||
|
|
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName(FFieldName).Value:=Trim(mvalue);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate YF_Money_CR ');
|
|||
|
|
sql.Add(' Set '+FFieldName+'='''+Trim(mvalue)+'''');
|
|||
|
|
SQL.Add(',Editer='''+Trim(DName)+'''');
|
|||
|
|
SQL.Add(',Edittime=getdate() ');
|
|||
|
|
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.v2KPMoneyPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue,FBBMoney,FKCBB,FFieldName:String;
|
|||
|
|
begin
|
|||
|
|
mvalue:=TcxTextEdit(Sender).EditingText;
|
|||
|
|
if Trim(mvalue)='' then
|
|||
|
|
begin
|
|||
|
|
mvalue:='0';
|
|||
|
|
end;
|
|||
|
|
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName(FFieldName).Value:=Trim(mvalue);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select isnull(KPMoney,0) KPMoney from YF_Money_CR where YFID='''+cds_hz.fieldbyname('YFID').AsString+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
FKCBB:=ADOQueryTemp.fieldbyname('KPMoney').AsString;
|
|||
|
|
FBBMoney:=CDS_HZ.fieldbyname('KPMoney').AsString;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate YF_Money_CR ');
|
|||
|
|
sql.Add(' Set '+FFieldName+'='+Trim(mvalue));
|
|||
|
|
SQL.Add(',Editer='''+Trim(DName)+'''');
|
|||
|
|
SQL.Add(',Edittime=getdate() ');
|
|||
|
|
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
|||
|
|
SQL.Add('Update YF_Money_KC Set KCKPMoney=KCKPMoney-'+FKCBB+'+'+FBBMoney);
|
|||
|
|
sql.Add(' where CRID='''+Trim(CDS_HZ.fieldbyname('CRID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.Button1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
IF CDS_HZ.IsEmpty then exit;
|
|||
|
|
|
|||
|
|
if CDS_HZ.Locate('ssel',true,[])=false then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
try
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
If fieldbyname('ssel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from YF_Money_CR ');
|
|||
|
|
sql.Add('where YFID='+quotedstr(trim(CDS_HZ.fieldbyname('YFID').AsString)));
|
|||
|
|
open;
|
|||
|
|
edit;
|
|||
|
|
Fieldbyname('Price').Value:=strtofloatdef(edit1.Text,0);
|
|||
|
|
Fieldbyname('Money').Value:=format('%.2f',[Fieldbyname('Qty').AsFloat * strtofloatdef(edit1.Text,0) ]);
|
|||
|
|
Fieldbyname('BBMoney').Value:=format('%.2f',[Fieldbyname('Qty').AsFloat * strtofloatdef(edit1.Text,0) ]);
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
First;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
InitGrid();
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.CheckBox1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
IF CDS_HZ.IsEmpty then exit;
|
|||
|
|
Label14.Caption:='0';
|
|||
|
|
Label16.Caption:='0';
|
|||
|
|
Label19.Caption:='0';
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
edit;
|
|||
|
|
fieldbyname('ssel').Value:=checkbox1.Checked;
|
|||
|
|
if checkbox1.Checked=true then
|
|||
|
|
begin
|
|||
|
|
Label14.Caption:=floattostr(strtofloat(Label14.Caption)+fieldbyname('Qty').AsCurrency);
|
|||
|
|
Label16.Caption:=floattostr(strtofloat(Label16.Caption)+fieldbyname('USDMoney').AsCurrency);
|
|||
|
|
Label19.Caption:=floattostr(strtofloat(Label19.Caption)+fieldbyname('RMBMoney').AsCurrency);
|
|||
|
|
end;
|
|||
|
|
post;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
First;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SetStatus();
|
|||
|
|
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
canshu1:=trim(DParameters1);
|
|||
|
|
canshu2:=trim(DParameters2);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.TchkClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
IF CDS_HZ.IsEmpty then exit;
|
|||
|
|
|
|||
|
|
if CDS_HZ.Locate('ssel',true,[])=false then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
IF Fieldbyname('ssel').AsBoolean=true then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update YF_Money_CR SET status=''2'' ');
|
|||
|
|
sql.Add('where YFID ='+quotedstr(trim(CDS_HZ.fieldbyname('YFID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
First;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
InitGrid();
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.TnochkClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
IF CDS_HZ.IsEmpty then exit;
|
|||
|
|
|
|||
|
|
if CDS_HZ.Locate('ssel',true,[])=false then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
IF Fieldbyname('ssel').AsBoolean=true then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update YF_Money_CR SET status=''1'' ');
|
|||
|
|
sql.Add('where YFID ='+quotedstr(trim(CDS_HZ.fieldbyname('YFID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
First;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
InitGrid();
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.nochkClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
IF CDS_HZ.IsEmpty then exit;
|
|||
|
|
if CDS_HZ.Locate('ssel',true,[])=false then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if chknote.Text='' then
|
|||
|
|
begin
|
|||
|
|
if application.MessageBox('ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD>עΪ<D7A2><CEAA><EFBFBD><EFBFBD>','<27><>ʾ',1)=2 then exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
IF Fieldbyname('ssel').AsBoolean=true then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update YF_Money_CR SET status=''0''');
|
|||
|
|
sql.add(',chkstatus=''<27><>ͨ<EFBFBD><CDA8>''');
|
|||
|
|
sql.add(',chknote='''+trim(chknote.Text)+''' ');
|
|||
|
|
sql.Add('where YFID ='+quotedstr(trim(CDS_HZ.fieldbyname('YFID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
First;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
InitGrid();
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.v2Column5PropertiesChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
toolbar1.SetFocus;
|
|||
|
|
HJ(CDS_HZ,Label14,CDS_HZ.fieldbyname('Qty').AsCurrency);
|
|||
|
|
HJ(CDS_HZ,Label16,CDS_HZ.fieldbyname('USDMoney').AsCurrency);
|
|||
|
|
HJ(CDS_HZ,Label19,CDS_HZ.fieldbyname('RMBMoney').AsCurrency);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.cxTabControl2Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
initgrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.TZZSHClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
IF CDS_HZ.IsEmpty then exit;
|
|||
|
|
if CDS_HZ.Locate('ssel',true,[])=false then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
IF Fieldbyname('ssel').AsBoolean=true then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update YF_Money_CR SET status=''3'' ');
|
|||
|
|
sql.Add('where YFID ='+quotedstr(trim(CDS_HZ.fieldbyname('YFID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
First;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
InitGrid();
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.TEJCXClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
IF CDS_HZ.IsEmpty then exit;
|
|||
|
|
|
|||
|
|
if CDS_HZ.Locate('ssel',true,[])=false then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
IF Fieldbyname('ssel').AsBoolean=true then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update YF_Money_CR SET status=''2'' ');
|
|||
|
|
sql.Add('where YFID ='+quotedstr(trim(CDS_HZ.fieldbyname('YFID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
First;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
InitGrid();
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.Tv2StylesGetContentStyle(
|
|||
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|||
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|||
|
|
var
|
|||
|
|
id,id10:Integer;
|
|||
|
|
begin
|
|||
|
|
Id:=Tv2.GetColumnByFieldName('ChkStatus').Index;
|
|||
|
|
if cxtabcontrol1.TabIndex=0 then
|
|||
|
|
begin
|
|||
|
|
if ARecord.Values[id]='<27><>ͨ<EFBFBD><CDA8>' then
|
|||
|
|
begin
|
|||
|
|
AStyle:=DataLink_YSYF.Red;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.Tv2CellDblClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
begin
|
|||
|
|
frmDJBCKKCList_DDSH:=TfrmDJBCKKCList_DDSH.create(self);
|
|||
|
|
with frmDJBCKKCList_DDSH do
|
|||
|
|
begin
|
|||
|
|
formid:='1';
|
|||
|
|
FConNo:=trim(self.CDS_HZ.fieldbyname('ConNoHZ').AsString);
|
|||
|
|
frmDJBCKKCList_DDSH.PRTCodeName.Text:=trim(self.CDS_HZ.fieldbyname('P_CodeName').AsString);
|
|||
|
|
frmDJBCKKCList_DDSH.PRTColor.Text:=trim(self.CDS_HZ.fieldbyname('PRTColor').AsString);
|
|||
|
|
frmDJBCKKCList_DDSH.PRTspec.Text:=trim(self.CDS_HZ.fieldbyname('P_Spec').AsString);
|
|||
|
|
if showmodal=1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSCR_SH.Tv2CellClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
begin
|
|||
|
|
if CDS_Main.IsEmpty=False then
|
|||
|
|
begin
|
|||
|
|
if (CDS_Main.FieldByName('ConNO').AsString=CDS_HZ.FieldByName('ConNoHZ').AsString)
|
|||
|
|
and (CDS_HZ.fieldbyname('P_CodeName').asstring=CDS_Main.FieldByName('PrtCodeName').AsString)
|
|||
|
|
and (CDS_HZ.fieldbyname('P_Spec').asstring=CDS_Main.FieldByName('PRTspec').AsString)
|
|||
|
|
and (CDS_HZ.fieldbyname('PRTColor').asstring=CDS_Main.FieldByName('PRTColor').AsString) then exit;
|
|||
|
|
end;
|
|||
|
|
Panel2.Visible:=true;
|
|||
|
|
Panel2.Refresh;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' Select PBCKDate=(select Top 1 F.CRTime from CK_SXPB_CR F inner join CK_SXPB_CR G on G.ORDMainidCK=F.ORDMainidCK and F.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
sql.add(' and isnull(F.CKName,'''')=''<27><><EFBFBD><EFBFBD>'' and G.CRFlag=''<27><><EFBFBD><EFBFBD>'' and isnull(G.CKName,'''')=''<27><><EFBFBD>첼'' and isnull(G.CRType,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
sql.add(' inner join JYOrderCon_Sub H on H.Subid=G.ConCKID inner join JYOrderCon_Main I on I.Mainid=H.Mainid where I.ConNo=AAA.ConNo order by F.CRTime desc)');
|
|||
|
|
sql.add(',HCDate=(select Top 1 F.CRTime from CK_SXPB_CR F inner join CK_SXPB_CR G on G.ORDMainidCK=F.ORDMainidRK and F.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
sql.add(' and isnull(F.CKName,'''')=''<27><><EFBFBD>첼'' and G.CRFlag=''<27><><EFBFBD><EFBFBD>'' and isnull(G.CKName,'''')=''<27><><EFBFBD>첼'' and isnull(G.CRType,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
sql.add(' inner join JYOrderCon_Sub H on H.Subid=G.ConCKID inner join JYOrderCon_Main I on I.Mainid=H.Mainid where I.ConNo=AAA.ConNo order by F.CRTime desc)');
|
|||
|
|
sql.Add(',JYDate=(select Top 1 F.FillTime from WFB_MJJY F inner join JYOrderCon_Sub G on F.ConID=G.Subid ');
|
|||
|
|
sql.add('inner join JYOrderCon_Main H on H.Mainid=G.Mainid where H.ConNo=AAA.ConNO order by F.FillTime desc)');
|
|||
|
|
sql.Add(',CKDate=(select Top 1 F.CRTime from CK_BanCP_CR F inner join JYOrderCon_Sub G on F.ConID=G.Subid ');
|
|||
|
|
sql.add('inner join JYOrderCon_Main H on H.Mainid=G.Mainid where H.ConNo=AAA.ConNO and F.CRFlag=''<27><><EFBFBD><EFBFBD>'' and F.CPType=''<27><>Ʒ'' order by F.CRTime desc) ');
|
|||
|
|
SQL.ADD(',AAA.ConNo,AAA.XHNO,AAA.StyleNo,AAA.PrtCode,AAA.PrtCodeName,AAA.PRTspec,AAA.SOrdDefStr4,AAA.PRTColorNo,AAA.PRTHX,AAA.PRTColor,AAA.PRTMF,AAA.PRTKZ,AAA.OrderUnit ');
|
|||
|
|
sql.add(',Sum(TPPS) TPPS,Sum(DJCKPS) DJCKPS,sumJYPS JYPS,SumCKPS CKPS,AAA.JYCPQty,AAA.JYCPPS');
|
|||
|
|
sql.add(',Sum(DDTPQty) DDTPQty,Sum(DDTPPS) DDTPPS,SumCKQty,SumJYQty,Sum(DJCKQty) DJCKQty,Sum(PRTOrderQty) PRTOrderQty,Sum(PRTOrderQty*1.02) PRTOrderQty2');
|
|||
|
|
sql.add(',Sum(PRTOrderQty*1.05) PRTOrderQty5,Sum(PRTOrderQty*1.1) PRTOrderQty10,Sum(PRTOrderQty*0.98) PRTOrderQty98,Sum(PRTOrderQty*0.95) PRTOrderQty95,Sum(PRTOrderQty*0.9) PRTOrderQty90');
|
|||
|
|
sql.add(',SumCKQty*1.02 SumCKQty2,SumCKQty*1.05 SumCKQty5,SumCKQty*1.1 SumCKQty10');
|
|||
|
|
sql.add(',SumCKQty*0.98 SumCKQty98,SumCKQty*0.95 SumCKQty95,SumCKQty*0.9 SumCKQty90');
|
|||
|
|
sql.add(',PBSH=(case when isnull(Sum(DDTPQty),0)=0 then 0 else (Sum(DDTPQty)-Sum(DJCKQty))/Sum(DDTPQty)*100 end)');
|
|||
|
|
sql.add(',JYSH=(case when isnull(Sum(DJCKQty),0)=0 then 0 else (Sum(DJCKQty)-sumJYQty)/Sum(DJCKQty)*100 end)');
|
|||
|
|
sql.add(',CPKC=(sumJYQty-SumCKQty)');
|
|||
|
|
sql.add('from (select AA.ConNo,AA.XHNO,AA.StyleNo,AA.PrtCode,AA.PrtCodeName,AA.PRTspec,AA.SOrdDefStr4,AA.PRTColorNo,AA.PRTHX,AA.PRTColor,AA.PRTMF,AA.PRTKZ,AA.PRTOrderQty,AA.OrderUnit ');
|
|||
|
|
sql.add(',AA.DJRKQty,AA.TPQty,Sum(AA.Qty) DJCKQty,AA.CKQty SumCKQty,AA.JYQty sumJYQty,AA.JYCPQty,AA.JYCPPS ');
|
|||
|
|
sql.add(',AA.DJRKPS,AA.TPPS,Sum(AA.PiQty) DJCKPS,AA.CKPS SumCKPS,AA.JYPS sumJYPS ');
|
|||
|
|
sql.Add(',DDTPQty=(case when isnull(AA.DJRKQty,0)=0 then 0 else cast(Sum(AA.Qty)/AA.DJRKQty*AA.TPQty as decimal(18,2)) end) ');
|
|||
|
|
sql.Add(',DDTPPS=(case when isnull(AA.DJRKPS,0)=0 then 0 else cast(Sum(AA.PiQty)/AA.DJRKPS*AA.TPPS as decimal(18,0)) end) ');
|
|||
|
|
sql.Add('from (select C.ConNo,B.XHNO,B.StyleNo,B.PrtCode,B.PrtCodeName,B.PRTspec,B.SOrdDefStr4,B.PRTColorNo,B.PRTHX,B.PRTColor,B.PRTMF,B.PRTKZ,B.PRTOrderQty,B.OrderUnit,A.Qty,A.PiQty ');
|
|||
|
|
sql.Add(',CKQty=(select isnull(Sum(F.MJQty4),0) from CK_BanCP_CR G inner join WFB_MJJY F on G.MJID=F.MJID where G.ConID=B.Subid and G.CRFlag=''<27><><EFBFBD><EFBFBD>'' and G.CPType=''<27><>Ʒ'') ');
|
|||
|
|
sql.Add(',CKPS=(select isnull(COUNT(G.MJID),0) from CK_BanCP_CR G where G.ConID=B.Subid and G.CRFlag=''<27><><EFBFBD><EFBFBD>'' and G.CPType=''<27><>Ʒ'') ');
|
|||
|
|
sql.Add(',JYQty=(select isnull(SUM(F.MJQty4),0) from WFB_MJJY F where F.ConID=B.Subid and F.MJType=''<27><>Ʒ'')');
|
|||
|
|
sql.Add(',JYPS=(select isnull(COUNT(F.MJID),0) from WFB_MJJY F where F.ConID=B.Subid and F.MJType=''<27><>Ʒ'')');
|
|||
|
|
sql.Add(',JYCPQty=(select isnull(SUM(F.MJQty4),0) from WFB_MJJY F where F.ConID=B.Subid and F.MJType=''<27><>Ʒ'')');
|
|||
|
|
sql.Add(',JYCPPS=(select isnull(Count(F.MJID),0) from WFB_MJJY F where F.ConID=B.Subid and F.MJType=''<27><>Ʒ'')');
|
|||
|
|
sql.Add(',DJRKQty=(select isnull(Sum(F.Qty),0) From CK_SXPB_CR F where F.OrdMainidRK=D.Mainid and F.CRFlag=''<27><><EFBFBD><EFBFBD>'' and isnull(F.CKName,'''')=''<27><><EFBFBD>첼'' and CRType=''<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'') ');
|
|||
|
|
sql.Add(',DJRKPS=(select isnull(Sum(F.PiQty),0) From CK_SXPB_CR F where F.OrdMainidRK=D.Mainid and F.CRFlag=''<27><><EFBFBD><EFBFBD>'' and isnull(F.CKName,'''')=''<27><><EFBFBD>첼'' and CRType=''<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'') ');
|
|||
|
|
sql.Add(',TPQty=(select isnull(Sum(F.Qty),0) from CK_SXPB_CR F left join CK_SXPB_CR G on G.SPID=F.FZSPID where F.ORDMainIdCK=D.Mainid and F.CRFlag=''<27><><EFBFBD><EFBFBD>'' and isnull(F.CKName,'''')=''<27><><EFBFBD><EFBFBD>'' and G.CRType<>''<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'') ');
|
|||
|
|
sql.Add(',TPPS=(select isnull(Sum(F.PiQty),0) from CK_SXPB_CR F left join CK_SXPB_CR G on G.SPID=F.FZSPID where F.ORDMainIdCK=D.Mainid and F.CRFlag=''<27><><EFBFBD><EFBFBD>'' and isnull(F.CKName,'''')=''<27><><EFBFBD><EFBFBD>'' and G.CRType<>''<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'') ');
|
|||
|
|
sql.Add('from CK_SXPB_CR A ');
|
|||
|
|
sql.Add('inner join JYOrderCon_Sub B on B.SubId=A.ConCKID ');
|
|||
|
|
sql.Add('inner join JYOrderCon_Main C on C.MainId=B.MainId ');
|
|||
|
|
sql.Add('left join JYOrder_Sub D on D.SubId=A.ORDSubIdCK ');
|
|||
|
|
sql.Add('left join JYOrder_Main E on E.MainId=D.MainId ');
|
|||
|
|
sql.Add('where A.CRFlag=''<27><><EFBFBD><EFBFBD>'' and isnull(A.CKName,'''')=''<27><><EFBFBD>첼'' ');
|
|||
|
|
sql.add('and isnull(A.CRType,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
sql.add(' and A.ConNO='''+Trim(CDS_HZ.fieldbyname('ConNOHZ').asstring)+''' and isnull(B.PrtCodeName,'''')='''+trim(CDS_HZ.fieldbyname('P_CodeName').asstring)+'''');
|
|||
|
|
sql.add(' and isnull(B.PRTspec,'''')='''+Trim(CDS_HZ.fieldbyname('P_Spec').asstring)+''' and isnull(B.PRTColor,'''')='''+trim(CDS_HZ.fieldbyname('PRTColor').asstring)+'''');
|
|||
|
|
sql.add(')AA ');
|
|||
|
|
sql.Add('group BY AA.ConNo,AA.XHNO,AA.StyleNo,AA.PrtCode,AA.PrtCodeName,AA.PRTspec,AA.SOrdDefStr4,AA.PRTColorNo,AA.PRTHX,AA.PRTColor,AA.PRTMF,AA.PRTKZ,AA.PRTOrderQty,AA.OrderUnit,AA.DJRKQty,AA.TPQty,AA.DJRKPS,AA.TPPS,');
|
|||
|
|
sql.add('AA.CKQty,AA.JYQty,AA.JYCPQty,AA.JYCPPS,AA.CKPS,AA.JYPS) AAA ');
|
|||
|
|
sql.Add('group by AAA.ConNo,AAA.XHNO,AAA.StyleNo,AAA.PrtCode,AAA.PrtCodeName,AAA.PRTspec,AAA.SOrdDefStr4,AAA.PRTColorNo,AAA.PRTHX,AAA.PRTColor,AAA.PRTMF,AAA.PRTKZ,AAA.OrderUnit,AAA.SumCKQty,AAA.sumJYQty,AAA.SumCKPS,AAA.sumJYPS,AAA.JYCPQty,AAA.JYCPPS');
|
|||
|
|
sql.add(' order by AAA.XHNO');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp,CDS_Main);
|
|||
|
|
SInitCDSData20(ADOQueryTemp,CDS_Main);
|
|||
|
|
Panel2.Visible:=false;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|