D7wmguihua/坯布码单待检(PBMDDJ.dll)/U_OrdCostZHList.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

787 lines
23 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_OrdCostZHList; //26
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, ExtCtrls, ToolWin, cxPC, cxControls,
cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
cxEdit, DB, cxDBData, cxCalendar, cxDropDownEdit, cxGridLevel,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
cxGridCustomView, cxGrid, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB,
DBClient, cxButtonEdit, cxGridBandedTableView, cxGridDBBandedTableView,
cxCheckBox, cxTextEdit, cxSplitter;
type
TfrmOrdCostZHList = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBExport: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
Label3: TLabel;
Label1: TLabel;
Label2: TLabel;
Label5: TLabel;
MPRTCodeName: TEdit;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
orderNo: TEdit;
Label7: TLabel;
MPRTCode: TEdit;
DataSource3: TDataSource;
ClientDataSet3: TClientDataSet;
ADOQueryCmd: TADOQuery;
ADOQueryTemp: TADOQuery;
ADOQuery1: TADOQuery;
cxGridPopupMenu3: TcxGridPopupMenu;
DataSource1: TDataSource;
ClientDataSet1: TClientDataSet;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQuery3: TADOQuery;
cxGridPopupMenu2: TcxGridPopupMenu;
DataSource2: TDataSource;
ClientDataSet2: TClientDataSet;
cxGridPopupMenu5: TcxGridPopupMenu;
ClientDataSet5: TClientDataSet;
DataSource5: TDataSource;
ScrollBox1: TScrollBox;
cxGrid3: TcxGrid;
Tv1: TcxGridDBTableView;
v3Column3: TcxGridDBColumn;
v3Column6: TcxGridDBColumn;
v3Column7: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
cxGridDBColumn7: TcxGridDBColumn;
cxGridDBColumn11: TcxGridDBColumn;
cxGridDBColumn14: TcxGridDBColumn;
cxGridDBColumn12: TcxGridDBColumn;
v3Column8: TcxGridDBColumn;
v3Column9: TcxGridDBColumn;
v3Column10: TcxGridDBColumn;
v3Column11: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
cxGrid2: TcxGrid;
Tv3: TcxGridDBTableView;
cxGridDBColumn10: TcxGridDBColumn;
cxGridDBColumn13: TcxGridDBColumn;
cxGridDBColumn18: TcxGridDBColumn;
cxGridDBColumn19: TcxGridDBColumn;
cxGridDBColumn20: TcxGridDBColumn;
cxGridDBColumn21: TcxGridDBColumn;
cxGridDBColumn22: TcxGridDBColumn;
cxGridDBColumn24: TcxGridDBColumn;
cxGridDBColumn25: TcxGridDBColumn;
cxGridDBColumn27: TcxGridDBColumn;
cxGridDBColumn28: TcxGridDBColumn;
cxGridDBTableView2Column1: TcxGridDBColumn;
cxGridDBTableView2Column2: TcxGridDBColumn;
cxGridDBTableView2Column3: TcxGridDBColumn;
v3Column4: TcxGridDBColumn;
cxGridLevel3: TcxGridLevel;
cxGrid1: TcxGrid;
Tv2: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
cxGridDBColumn2: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
cxGridDBColumn5: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
cxGridDBColumn8: TcxGridDBColumn;
cxGridDBColumn9: TcxGridDBColumn;
Tv3Column1: TcxGridDBColumn;
Tv3Column2: TcxGridDBColumn;
Tv3Column3: TcxGridDBColumn;
cxGridDBColumn15: TcxGridDBColumn;
cxGridDBColumn16: TcxGridDBColumn;
cxGridDBColumn17: TcxGridDBColumn;
Tv2Column1: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
cxGrid5: TcxGrid;
Tv5: TcxGridDBTableView;
cxGridDBColumn23: TcxGridDBColumn;
cxGridDBColumn26: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
v5Column1: TcxGridDBColumn;
v5Column2: TcxGridDBColumn;
v5Column5: TcxGridDBColumn;
cxGridLevel4: TcxGridLevel;
ClientDataSet7: TClientDataSet;
cxGridPopupMenu7: TcxGridPopupMenu;
DataSource7: TDataSource;
v5Column6: TcxGridDBColumn;
v5Column7: TcxGridDBColumn;
Label11: TLabel;
CZZSH: TLabel;
ToolButton1: TToolButton;
Panel2: TPanel;
cxGrid7: TcxGrid;
Tv7: TcxGridDBTableView;
cxGridDBColumn34: TcxGridDBColumn;
cxGridDBColumn30: TcxGridDBColumn;
cxGridDBColumn31: TcxGridDBColumn;
cxGridDBColumn32: TcxGridDBColumn;
cxGridDBColumn36: TcxGridDBColumn;
cxGridLevel5: TcxGridLevel;
v7Column1: TcxGridDBColumn;
Panel3: TPanel;
cxGrid4: TcxGrid;
Tv0: TcxGridDBTableView;
cxGridDBColumn29: TcxGridDBColumn;
cxGridDBColumn33: TcxGridDBColumn;
cxGridDBColumn35: TcxGridDBColumn;
cxGridLevel6: TcxGridLevel;
ClientDataSet0: TClientDataSet;
cxGridPopupMenu0: TcxGridPopupMenu;
DataSource0: TDataSource;
ADOQueryMain: TADOQuery;
cxSplitter2: TcxSplitter;
Label4: TLabel;
SGJSSH: TEdit;
Button1: TButton;
Label6: TLabel;
Label8: TLabel;
HZSHQty: TLabel;
v7Column2: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
v3Column1: TcxGridDBColumn;
cxSplitter4: TcxSplitter;
ToolButton2: TToolButton;
v0Column1: TcxGridDBColumn;
v3Column2: TcxGridDBColumn;
Panel4: TPanel;
cxSplitter1: TcxSplitter;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBRafreshClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure orderNoKeyPress(Sender: TObject; var Key: Char);
procedure TBExportClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Tv1CellClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure v5Column1PropertiesEditValueChanged(Sender: TObject);
procedure v5Column5PropertiesEditValueChanged(Sender: TObject);
procedure v5Column2PropertiesEditValueChanged(Sender: TObject);
procedure v5Column3PropertiesEditValueChanged(Sender: TObject);
procedure v5Column4PropertiesEditValueChanged(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure Tv0CellClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure Button1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
private
{ Private declarations }
canshu1,canshu2:string;
procedure InitSubGrid();
procedure InitHZSubGrid();
public
{ Public declarations }
end;
var
frmOrdCostZHList: TfrmOrdCostZHList;
implementation
uses
U_DataLink,U_RTFun, U_ModuleNote;
{$R *.dfm}
procedure TfrmOrdCostZHList.FormDestroy(Sender: TObject);
begin
frmOrdCostZHList:=nil;
end;
procedure TfrmOrdCostZHList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmOrdCostZHList.TBRafreshClick(Sender: TObject);
var
fsj:string;
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('select A.MainId,MPRTCode=RTrim(A.MPRTCode),A.MPRTCodeName,A.OrderNo,A.SGJSSH,A.Filler from JYOrder_Main A where OrdDate>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.DateTime))+'''');
sql.Add(' and OrdDate<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.DateTime+1))+'''');
SQL.Add(' and OrderNo not like ''KC%'' ');
Open;
end;
SCreateCDS20(ADOQueryMain,ClientDataSet0);
SInitCDSData20(ADOQueryMain,ClientDataSet0);
finally
ADOQueryMain.EnableControls;
end;
//TBFind.Click;
end;
procedure TfrmOrdCostZHList.FormCreate(Sender: TObject);
begin
canshu1:=Trim(DParameters1);
canshu2:=Trim(DParameters2);
EndDate.Date:=SGetServerDate(ADOQueryTemp);
BegDate.Date:=EndDate.Date-60;
end;
procedure TfrmOrdCostZHList.TBCloseClick(Sender: TObject);
begin
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>a2',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>뵥a2',Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid('<27><><EFBFBD>ڲֿ<DAB2>a2',Tv3,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1',Tv7,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',Tv0,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Close;
end;
procedure TfrmOrdCostZHList.TBFindClick(Sender: TObject);
begin
if ADOQueryMain.Active=False then Exit;
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,ClientDataSet0);
SInitCDSData20(ADOQueryMain,ClientDataSet0);
end;
procedure TfrmOrdCostZHList.orderNoKeyPress(Sender: TObject; var Key: Char);
var
fsj:string;
begin
if Key=#13 then
begin
if Trim(orderNo.Text)='' then Exit;
if Length(Trim(orderNo.Text))<4 then Exit;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('select A.MainId,MPRTCode=RTrim(A.MPRTCode)+RTrim(A.MPRTGY),A.MPRTCodeName,A.OrderNo,A.Filler,A.SGJSSH from JYOrder_Main A where ');
sql.Add(' A.orderno like '''+'%'+Trim(orderNo.Text)+'%'+'''');
Open;
end;
SCreateCDS20(ADOQueryMain,ClientDataSet0);
SInitCDSData20(ADOQueryMain,ClientDataSet0);
finally
ADOQueryMain.EnableControls;
end;
end;
end;
procedure TfrmOrdCostZHList.TBExportClick(Sender: TObject);
begin
if ClientDataSet3.IsEmpty then Exit;
end;
procedure TfrmOrdCostZHList.FormShow(Sender: TObject);
begin
READCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>a2',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
READCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>뵥a2',Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
READCxGrid('<27><><EFBFBD>ڲֿ<DAB2>a2',Tv3,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
READCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1',Tv7,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
READCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',Tv0,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmOrdCostZHList.Tv1CellClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
var
fsj:string;
begin
if ClientDataSet1.IsEmpty then Exit;
{ fsj:='select distinct(PSName) Name, Cast('''' as varchar(20)) code from JYOrder_Process where Mainid='''+Trim(ClientDataSet1.fieldbyname('ORDMainId').AsString)+'''';
SInitComBoxBySql(ADOQueryTemp,PSName,False,fsj); }
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add('select A.*,B.PRTHX,B.PRTColorNo ');
sql.Add('from JYOrder_Main_MD A');
sql.Add(' left join JYOrder_Sub B on A.ORDSubId=B.SubId');
sql.Add(' where A.ORDMainId='''+Trim(ClientDataSet1.fieldbyname('ORDMainId').AsString)+'''');
sql.Add(' and A.FactoryNo='''+Trim(ClientDataSet1.fieldbyname('FactoryNo').AsString)+'''');
sql.Add(' and A.ConSubId='''+Trim(ClientDataSet1.fieldbyname('ConSubId').AsString)+'''');
sql.Add(' and isnull(A.CKName,'''')='''' ');
Open;
end;
SCreateCDS20(ADOQuery1,ClientDataSet2);
SInitCDSData20(ADOQuery1,ClientDataSet2);
end;
procedure TfrmOrdCostZHList.InitSubGrid();
begin
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add('select A.*,B.PRTHX,B.PRTColorNo,JM.OrderNo, ');
sql.Add('KKZZR=(select sum(ZZPonMoney) from JYOrder_Main_MD_KK KK where KK.MDID=A.MDID and KK.KKTYpe=''<27><><EFBFBD><EFBFBD>'' ),');
sql.Add('KKZZC=(select sum(ZZFtyMoney) from JYOrder_Main_MD_KK KK where KK.MDID=A.MDID and KK.KKTYpe=''<27><><EFBFBD><EFBFBD>'' )');
sql.Add('from JYOrder_Main_MD A');
sql.Add(' left join JYOrder_Sub B on A.ORDSubId=B.SubId');
SQL.Add(' inner join JYOrder_Main JM on A.OrdMainid=JM.MainId');
sql.Add(' where A.ORDMainId='''+Trim(ClientDataSet0.fieldbyname('MainId').AsString)+'''');
sql.Add(' and isnull(A.CKName,'''')<>'''' ');
Open;
end;
SCreateCDS20(ADOQuery1,ClientDataSet3);
SInitCDSData20(ADOQuery1,ClientDataSet3);
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add(' exec P_View_PSNameSH :MainId');
Parameters.ParamByName('MainId').Value:=Trim(ClientDataSet0.fieldbyname('MainId').AsString);
Open;
end;
SCreateCDS20(ADOQuery1,ClientDataSet5);
SInitCDSData20(ADOQuery1,ClientDataSet5);
CZZSH.Visible:=True;
CZZSH.Caption:=Trim(ClientDataSet5.fieldbyname('HZSH').AsString)+'%';
HZSHQty.Visible:=True;
HZSHQty.Caption:=Trim(ClientDataSet5.fieldbyname('HZSHQty').AsString)+'KG';
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add('exec P_View_MDQtyFooter :MainId');
Parameters.ParamByName('MainId').Value:=Trim(ClientDataSet0.fieldbyname('MainId').AsString);
Open;
end;
SCreateCDS20(ADOQuery1,ClientDataSet7);
SInitCDSData20(ADOQuery1,ClientDataSet7);
end;
procedure TfrmOrdCostZHList.InitHZSubGrid();
begin
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add('select A.*,B.PRTHX,B.PRTColorNo,JM.OrderNo, ');
sql.Add('KKZZR=(select sum(ZZPonMoney) from JYOrder_Main_MD_KK KK where KK.MDID=A.MDID and KK.KKTYpe=''<27><><EFBFBD><EFBFBD>'' ),');
sql.Add('KKZZC=(select sum(ZZFtyMoney) from JYOrder_Main_MD_KK KK where KK.MDID=A.MDID and KK.KKTYpe=''<27><><EFBFBD><EFBFBD>'' )');
sql.Add('from JYOrder_Main_MD A');
sql.Add(' left join JYOrder_Sub B on A.ORDSubId=B.SubId');
SQL.Add(' inner join JYOrder_Main JM on A.OrdMainid=JM.MainId');
sql.Add(' where A.ORDMainId in (select MainId from JS_User_MainId where UserName='''+Trim(DName)+''')');
sql.Add(' and isnull(A.CKName,'''')<>'''' ');
Open;
end;
SCreateCDS20(ADOQuery1,ClientDataSet3);
SInitCDSData20(ADOQuery1,ClientDataSet3);
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add(' exec P_View_PSNameSH_User :UserName');
Parameters.ParamByName('UserName').Value:=Trim(DName);
Open;
end;
SCreateCDS20(ADOQuery1,ClientDataSet5);
SInitCDSData20(ADOQuery1,ClientDataSet5);
CZZSH.Visible:=True;
CZZSH.Caption:=Trim(ClientDataSet5.fieldbyname('HZSH').AsString)+'%';
HZSHQty.Visible:=True;
HZSHQty.Caption:=Trim(ClientDataSet5.fieldbyname('HZSHQty').AsString)+'KG';
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add('exec P_View_MDQtyFooter_User :UserName');
Parameters.ParamByName('UserName').Value:=Trim(DName);
Open;
end;
SCreateCDS20(ADOQuery1,ClientDataSet7);
SInitCDSData20(ADOQuery1,ClientDataSet7);
end;
procedure TfrmOrdCostZHList.v5Column1PropertiesEditValueChanged(
Sender: TObject);
var
mvalue:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
if Trim(mvalue)='' then
mvalue:='0';
with ClientDataSet5 do
begin
Edit;
FieldByName('PSSJSH').Value:=mvalue;
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Process Set PSSJSH='+Trim(mvalue));
sql.Add(' where PSID='''+Trim(ClientDataSet5.fieldbyname('PSID').AsString)+'''');
ExecSQL;
end;
end;
procedure TfrmOrdCostZHList.v5Column5PropertiesEditValueChanged(
Sender: TObject);
var
mvalue:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
with ClientDataSet5 do
begin
Edit;
FieldByName('PSSJNote').Value:=mvalue;
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Process Set PSSJNote='''+Trim(mvalue)+'''');
sql.Add(' where PSID='''+Trim(ClientDataSet5.fieldbyname('PSID').AsString)+'''');
ExecSQL;
end;
end;
procedure TfrmOrdCostZHList.v5Column2PropertiesEditValueChanged(
Sender: TObject);
var
mvalue,FQty,FMoney:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
if Trim(mvalue)='' then
mvalue:='0';
with ClientDataSet5 do
begin
Edit;
FieldByName('PSSJQty').Value:=mvalue;
Post;
end;
FQty:=ClientDataSet5.fieldbyname('PSSJQty').AsString;
FMoney:=ClientDataSet5.fieldbyname('PSSJMoney').AsString;
if Trim(FMoney)='' then
FMoney:='0';
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Process Set PSSJQty='+Trim(FQty));
sql.Add(' where PSID='''+Trim(ClientDataSet5.fieldbyname('PSID').AsString)+'''');
ExecSQL;
end;
if ClientDataSet5.fieldbyname('PSSJQty').Value<>0 then
begin
with ClientDataSet5 do
begin
Edit;
FieldByName('PSSJPrice').Value:=StrToFloat(FMoney)/ClientDataSet5.fieldbyname('PSSJQty').Value;
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Process Set PSSJPrice='+Trim(ClientDataSet5.fieldbyname('PSSJPrice').AsString));
sql.Add(' where PSID='''+Trim(ClientDataSet5.fieldbyname('PSID').AsString)+'''');
ExecSQL;
end;
end;
end;
procedure TfrmOrdCostZHList.v5Column3PropertiesEditValueChanged(
Sender: TObject);
var
mvalue,FQty,FMoney:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
if Trim(mvalue)='' then
mvalue:='0';
with ClientDataSet5 do
begin
Edit;
FieldByName('PSSJMoney').Value:=mvalue;
Post;
end;
FQty:=ClientDataSet5.fieldbyname('PSSJQty').AsString;
FMoney:=ClientDataSet5.fieldbyname('PSSJMoney').AsString;
if Trim(FQty)='' then
FQty:='0';
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Process Set PSSJMoney='+Trim(FMoney));
sql.Add(' where PSID='''+Trim(ClientDataSet5.fieldbyname('PSID').AsString)+'''');
ExecSQL;
end;
if ClientDataSet5.fieldbyname('PSSJQty').Value<>0 then
begin
with ClientDataSet5 do
begin
Edit;
FieldByName('PSSJPrice').Value:=StrToFloat(FMoney)/strtofloat(FQty);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Process Set PSSJPrice='+Trim(ClientDataSet5.fieldbyname('PSSJPrice').AsString));
sql.Add(' where PSID='''+Trim(ClientDataSet5.fieldbyname('PSID').AsString)+'''');
ExecSQL;
end;
end;
end;
procedure TfrmOrdCostZHList.v5Column4PropertiesEditValueChanged(
Sender: TObject);
var
mvalue:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
if Trim(mvalue)='' then
mvalue:='0';
with ClientDataSet5 do
begin
Edit;
FieldByName('PSSJPrice').Value:=mvalue;
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update JYOrder_Process Set PSSJPrice='+Trim(mvalue));
sql.Add(' where PSID='''+Trim(ClientDataSet5.fieldbyname('PSID').AsString)+'''');
ExecSQL;
end;
end;
procedure TfrmOrdCostZHList.ToolButton1Click(Sender: TObject);
begin
try
frmModuleNote:=TfrmModuleNote.Create(Application);
with frmModuleNote do
begin
flag:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>)';
if ShowModal=1 then
begin
end;
end;
finally
frmModuleNote.Free;
end;
end;
procedure TfrmOrdCostZHList.Tv0CellClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
begin
if ClientDataSet0.IsEmpty then Exit;
SGJSSH.Text:=Trim(ClientDataSet0.fieldbyname('SGJSSH').AsString);
try
ADOQuery3.DisableControls;
with ADOQuery3 do
begin
Close;
sql.Clear;
SQL.Add('exec P_View_OrderCostMainIdQty :MainId');
Parameters.ParamByName('MainId').Value:=Trim(ClientDataSet0.fieldbyname('MainId').AsString);
Open;
end;
SCreateCDS20(ADOQuery3,ClientDataSet1);
SInitCDSData20(ADOQuery3,ClientDataSet1);
finally
ADOQuery3.EnableControls;
end;
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add('select A.*,B.PRTHX,B.PRTColorNo ');
sql.Add('from JYOrder_Main_MD A');
sql.Add(' left join JYOrder_Sub B on A.ORDSubId=B.SubId');
sql.Add(' where 1<>1');
Open;
end;
SCreateCDS20(ADOQuery1,ClientDataSet2);
SInitCDSData20(ADOQuery1,ClientDataSet2);
InitSubGrid();
end;
procedure TfrmOrdCostZHList.Button1Click(Sender: TObject);
var
FReal:Double;
begin
if ClientDataSet0.IsEmpty then Exit;
{if Trim(DName)<>Trim(ClientDataSet0.fieldbyname('Filler').AsString) then
begin
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><CBB6><EFBFBD>!','<27><>ʾ',0);
Exit;
end; }
if Trim(SGJSSH.Text)<>'' then
begin
if TryStrToFloat(SGJSSH.Text,FReal)=False then
begin
Application.MessageBox('<27>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķǷ<C4B7><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
end;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
with ADOQueryCmd do
begin
Close;
sql.Clear;
if Trim(SGJSSH.Text)<>'' then
sql.Add('Update JYOrder_Main Set SGJSSH='+SGJSSH.Text)
else
sql.Add('Update JYOrder_Main Set SGJSSH=NULL');
sql.Add(' where MainId='''+Trim(ClientDataSet0.fieldbyname('MainId').AsString)+'''');
ExecSQL;
end;
with ClientDataSet0 do
begin
Edit;
if Trim(SGJSSH.Text)<>'' then
FieldByName('SGJSSH').Value:=SGJSSH.Text
else
FieldByName('SGJSSH').Value:=null;
Post;
end;
end;
procedure TfrmOrdCostZHList.ToolButton2Click(Sender: TObject);
var
fsj:string;
i:Integer;
begin
if ClientDataSet0.IsEmpty then Exit;
if ClientDataSet0.Locate('SSel',True,[])=False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD>񶩵<EFBFBD>!','<27><>ʾ',0);
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete JS_User_MainId where UserName='''+Trim(DName)+'''');
ExecSQL;
end;
with ClientDataSet0 do
begin
First;
while Locate('SSel;SFlag',VarArrayOf([True,'1']),[loPartialKey])=True do
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into JS_User_MainId select '''+Trim(DName)+''','''+Trim(ClientDataSet0.fieldbyname('MainId').AsString)+'''');
// sql.Add('insert into JS_User_MainId select :UserName,:Mainid');
//ShowMessage(sql.Text);
ExecSQL;
end;
Edit;
FieldByName('SFlag').Value:='9';
Post;
end;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select PSXH,PSName,PSSH,MFQty,KZQty,KgZM from JYOrder_Process where Mainid in (select Mainid from JS_User_MainId where UserName='''+Trim(DName)+''')');
sql.Add(' group by PSXH,PSName,PSSH,MFQty,KZQty,KgZM');
Open;
end;
i:=ADOQueryTemp.RecordCount;
with ClientDataSet0 do
begin
First;
while Locate('SSel;SFlag',VarArrayOf([True,'9']),[loPartialKey])=True do
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select PSXH,PSName,PSSH,MFQty,KZQty,KgZM from JYOrder_Process where Mainid='''+Trim(ClientDataSet0.fieldbyname('Mainid').AsString)+'''');
sql.Add(' group by PSXH,PSName,PSSH,MFQty,KZQty,KgZM');
Open;
end;
if ADOQueryTemp.RecordCount<>i then
begin
with ClientDataSet0 do
begin
First;
while Locate('SSel;SFlag',VarArrayOf([True,'9']),[loPartialKey])=True do
begin
Edit;
FieldByName('SFlag').Value:='1';
Post;
end;
end;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>Ϣ<EFBFBD><CFA2>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ܺϲ<DCBA><CFB2><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
Edit;
FieldByName('SFlag').Value:='1';
Post;
end;
end;
Panel4.Visible:=True;
Panel4.Refresh;
//SGJSSH.Text:=Trim(ClientDataSet0.fieldbyname('SGJSSH').AsString);
try
ADOQuery3.DisableControls;
with ADOQuery3 do
begin
Close;
sql.Clear;
SQL.Add('exec P_View_OrderCostMainIdQty_User :UserName');
Parameters.ParamByName('UserName').Value:=Trim(DName);
//ShowMessage(sql.Text);
Open;
end;
SCreateCDS20(ADOQuery3,ClientDataSet1);
SInitCDSData20(ADOQuery3,ClientDataSet1);
finally
ADOQuery3.EnableControls;
end;
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add('select A.*,B.PRTHX,B.PRTColorNo ');
sql.Add('from JYOrder_Main_MD A');
sql.Add(' left join JYOrder_Sub B on A.ORDSubId=B.SubId');
sql.Add(' where 1<>1');
Open;
end;
SCreateCDS20(ADOQuery1,ClientDataSet2);
SInitCDSData20(ADOQuery1,ClientDataSet2);
InitHZSubGrid();
Panel4.Visible:=False;
end;
end.