1195 lines
37 KiB
ObjectPascal
1195 lines
37 KiB
ObjectPascal
|
|
unit U_XiaoShouDataNewListQB;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
|||
|
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
|||
|
|
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
|
|||
|
|
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|||
|
|
cxGrid, DBClient, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System,
|
|||
|
|
RM_Common, RM_Class, RM_GridReport, RM_e_Xls, Menus, cxButtonEdit,
|
|||
|
|
cxDropDownEdit, cxPC, Buttons, BtnEdit, cxTextEdit, cxLookAndFeels,
|
|||
|
|
cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmXiaoShouDataNewListQB = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBFind: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
Order_Main: TClientDataSet;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
v1Column1: TcxGridDBColumn;
|
|||
|
|
v1Column7: TcxGridDBColumn;
|
|||
|
|
v1Column9: TcxGridDBColumn;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
EndDate: TDateTimePicker;
|
|||
|
|
v1Column17: TcxGridDBColumn;
|
|||
|
|
v1Column5: TcxGridDBColumn;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
MPRTCodeName: TEdit;
|
|||
|
|
v1Column3: TcxGridDBColumn;
|
|||
|
|
v1Column4: TcxGridDBColumn;
|
|||
|
|
v1Column6: TcxGridDBColumn;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
PRTColor: TEdit;
|
|||
|
|
labMYType: TLabel;
|
|||
|
|
v1Column10: TcxGridDBColumn;
|
|||
|
|
v1Column11: TcxGridDBColumn;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
PRTHX: TEdit;
|
|||
|
|
v1Column8: TcxGridDBColumn;
|
|||
|
|
cxTabControl1: TcxTabControl;
|
|||
|
|
v1Column2: TcxGridDBColumn;
|
|||
|
|
v1Column12: TcxGridDBColumn;
|
|||
|
|
v1Column13: TcxGridDBColumn;
|
|||
|
|
v1Column14: TcxGridDBColumn;
|
|||
|
|
v1Column15: TcxGridDBColumn;
|
|||
|
|
v1Column16: TcxGridDBColumn;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
v1SSel: TcxGridDBColumn;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
CDS_Sub: TClientDataSet;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
Tv2: TcxGridDBTableView;
|
|||
|
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn5: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn6: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn7: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn8: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn9: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn10: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn11: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn12: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn13: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn14: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn15: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
DataSource2: TDataSource;
|
|||
|
|
ADOQuery1: TADOQuery;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
Panel3: TPanel;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
KHName: TBtnEditC;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
CustomerNoName: TEdit;
|
|||
|
|
ToolButton3: TToolButton;
|
|||
|
|
Button1: TButton;
|
|||
|
|
Panel10: TPanel;
|
|||
|
|
Image2: TImage;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
KHDept: TComboBox;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
KHLXR: TComboBox;
|
|||
|
|
v1Column18: TcxGridDBColumn;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
KHLXFS: TEdit;
|
|||
|
|
Label11: TLabel;
|
|||
|
|
RadioGroup1: TRadioGroup;
|
|||
|
|
ToolButton4: TToolButton;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
RMDBHZ: TRMDBDataSet;
|
|||
|
|
CDS_PRT: TClientDataSet;
|
|||
|
|
RMXLSExport2: TRMXLSExport;
|
|||
|
|
v1Column19: TcxGridDBColumn;
|
|||
|
|
v2Column1: TcxGridDBColumn;
|
|||
|
|
v1Column20: TcxGridDBColumn;
|
|||
|
|
Panel4: TPanel;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
MDName: TBtnEditA;
|
|||
|
|
ADOQueryPrint1: TADOQuery;
|
|||
|
|
ADOQueryPrint: TADOQuery;
|
|||
|
|
RMDBHZ1: TRMDBDataSet;
|
|||
|
|
ADOQuery2: TADOQuery;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure TBFindClick(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
|
procedure CheckBox2Click(Sender: TObject);
|
|||
|
|
procedure CustomerNoNameChange(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure ZJStatusChange(Sender: TObject);
|
|||
|
|
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
|
procedure v1SSelPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure KHNameBtnUpClick(Sender: TObject);
|
|||
|
|
procedure KHNameBtnDnClick(Sender: TObject);
|
|||
|
|
procedure N1Click(Sender: TObject);
|
|||
|
|
procedure N2Click(Sender: TObject);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure Image2Click(Sender: TObject);
|
|||
|
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
|
procedure Button1Click(Sender: TObject);
|
|||
|
|
procedure Panel10MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
|||
|
|
procedure KHLXRChange(Sender: TObject);
|
|||
|
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
|
procedure MDNameBtnClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
canshu1: string;
|
|||
|
|
DQdate: TDateTime;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure InitForm();
|
|||
|
|
function SaveData(): Boolean;
|
|||
|
|
procedure initDataMX(FCKNO: string);
|
|||
|
|
function YFData(): Boolean;
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
FKHName: string;
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmXiaoShouDataNewListQB: TfrmXiaoShouDataNewListQB;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_KHListSelJJ, U_ZDYHelp;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmXiaoShouDataNewListQB := nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
cxgrid1.Align := alClient;
|
|||
|
|
canshu1 := Trim(DParameters1);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid('<27><>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϢQBYX', Tv1, 'ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.InitGrid();
|
|||
|
|
begin
|
|||
|
|
Panel2.Visible := True;
|
|||
|
|
Panel2.Refresh;
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('select CRTime=B.FHDate,ConNo=D.MLConNo,CustomerNoName=B.SHDanWei,A.FeeName,OrderNo=D.MLOrderNo,');
|
|||
|
|
sql.Add('YWY=B.Salesman,MPRTCodeName=A.MXPrtName,PRTColor=A.MXPrtColor,SOrdDefStr1=isnull(C.MLColorNoKH,C.MLColorNo),');
|
|||
|
|
sql.Add('PRTHX=A.MXPrtHX,PS=A.FHPS'); //,Qty=A.FHMQty
|
|||
|
|
sql.Add(',CASE WHEN( (select X.QtyUnit from ML_ConSub X where X.CSID=C.ConSubId ) in (''KG'' , ''ǧ<><C7A7>'') ) THEN FHKgQty ELSE FHMQty END AS Qty');
|
|||
|
|
sql.Add(',CASE WHEN(isnull(D.MLConNo,'''') <> '''') THEN (select X.QtyUnit from ML_ConSub X where X.CSID=C.ConSubId ) ELSE ''M'' END AS QtyUnit');
|
|||
|
|
sql.Add(',BZType=isnull(D.BZType,''<27><>''),PRTPrice=C.MLPrice,');
|
|||
|
|
sql.Add('HZFee=isnull(A.FeeMoney,0),');
|
|||
|
|
sql.Add('FHMoney=isnull(C.MLPrice,0)'); //*isnull(A.FHMQty,0)
|
|||
|
|
sql.Add('* isnull(CASE WHEN( (select X.QtyUnit from ML_ConSub X where X.CSID=C.ConSubId ) in (''KG'' , ''ǧ<><C7A7>'') ) THEN FHKgQty ELSE FHMQty END ,0)');
|
|||
|
|
sql.Add('+ isnull(A.FeeMoney,0),B.KHNO ');
|
|||
|
|
sql.Add(',SPID=A.SSID,CKOrdNo=B.FSID,A.FSID,A.SSID');
|
|||
|
|
sql.Add(' from FHSQ_Sub A');
|
|||
|
|
sql.Add(' inner join FHSQ_Main B on A.FSID=B.FSID');
|
|||
|
|
SQL.Add(' inner join ML_OrderSubidNew C on A.SubId=C.NewSubId');
|
|||
|
|
SQL.Add(' inner join ML_OrderMainNew D on A.MainId=D.NewMLID');
|
|||
|
|
if cxTabControl1.TabIndex = 0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add('where A.CWFlag=0 and isnull(A.FHMQty,0)<>0');
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
sql.Add('where B.FHDate>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date)) + '''');
|
|||
|
|
sql.Add('and B.FHDate<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.Date + 1)) + '''');
|
|||
|
|
sql.Add('and CWFlag=1');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
sql.Add(' UNION all ');
|
|||
|
|
sql.Add(' select CRTime,conno=ToConNo,CustomerNoName=custName,FeeName=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',OrderNo=ToOrderNo ');
|
|||
|
|
sql.Add(' ,YWY=Filler,MPRTCodeName=P_CodeName,PRTColor=isnull(P_Color,KHColor),sehao COLLATE DATABASE_DEFAULT AS SOrdDefStr1 ');
|
|||
|
|
sql.Add(' ,PRTHX='''',PS=1,qty,QtyUnit=''M'',BZType=''<27><>'',PRTPrice=Price,HZFee=null,FHMoney=money,KHNO=CustNo,SPID=CRID,CKOrdNo=CRNO,FSID=CRNO,SSID=CRID ');
|
|||
|
|
sql.Add(' from YP_InOut2 ');
|
|||
|
|
sql.Add(' where CRFlag=''<27><><EFBFBD><EFBFBD>'' and CRType =''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'' and valid=''Y'' ');
|
|||
|
|
if cxTabControl1.TabIndex = 0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add('and isnull(CWFlag,0)=0 ');
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
sql.Add('and CRTime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date)) + '''');
|
|||
|
|
sql.Add('and CRTime<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.Date + 1)) + '''');
|
|||
|
|
sql.Add('and isnull(CWFlag,0)=1');
|
|||
|
|
end;
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
TBFind.Click;
|
|||
|
|
Panel2.Visible := False;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.InitForm();
|
|||
|
|
begin
|
|||
|
|
BegDate.Date := SGetServerDate(ADOQueryTemp);
|
|||
|
|
EndDate.Date := BegDate.Date;
|
|||
|
|
ReadCxGrid('<27><>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϢQBYX', Tv1, 'ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
MDName.Text := Trim('<27><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>');
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.TBFindClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active = False then
|
|||
|
|
Exit;
|
|||
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitForm();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.CheckBox1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.CheckBox2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.CustomerNoNameChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active = False then
|
|||
|
|
Exit;
|
|||
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.ZJStatusChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBFind.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
|
begin
|
|||
|
|
if cxTabControl1.TabIndex = 0 then
|
|||
|
|
begin
|
|||
|
|
if CustomerNoName.Text = '' then
|
|||
|
|
begin
|
|||
|
|
v1SSel.Options.Focusing := False;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
v1SSel.Options.Focusing := True;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.v1SSelPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue, Fmvalue: Boolean;
|
|||
|
|
FCKOrdNo: string;
|
|||
|
|
begin
|
|||
|
|
mvalue := TcxCheckBox(Sender).EditingValue;
|
|||
|
|
if mvalue = True then
|
|||
|
|
begin
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('SSel').Value := True;
|
|||
|
|
end;
|
|||
|
|
Fmvalue := False;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('SSel').Value := False;
|
|||
|
|
end;
|
|||
|
|
mvalue := False;
|
|||
|
|
Fmvalue := True;
|
|||
|
|
end;
|
|||
|
|
FCKOrdNo := Trim(Order_Main.fieldbyname('CKOrdNo').AsString);
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while Locate('CKOrdNo;SSel', VarArrayOf([FCKOrdNo, Fmvalue]), [loPartialKey]) do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('SSel').Value := mvalue;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.KHNameBtnUpClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fsj: string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmKHListSelJJ := TfrmKHListSelJJ.Create(Application);
|
|||
|
|
with frmKHListSelJJ do
|
|||
|
|
begin
|
|||
|
|
frmKHListSelJJ.canshu2 := '<27><>Ȩ<EFBFBD><C8A8>';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
Self.KHName.Text := Trim(frmKHListSelJJ.CDS_HZ.fieldbyname('KHNameJC').AsString);
|
|||
|
|
Self.KHName.TxtCode := Trim(frmKHListSelJJ.CDS_HZ.fieldbyname('KHLXR').AsString);
|
|||
|
|
Self.KHName.Hint := Trim(frmKHListSelJJ.CDS_HZ.fieldbyname('KHNo').AsString);
|
|||
|
|
Self.KHDept.Clear;
|
|||
|
|
Self.KHLXR.Clear;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmKHListSelJJ.Free;
|
|||
|
|
end;
|
|||
|
|
fsj := 'select Name=KHDept from CK_YCL_CR_Main where isnull(FactoryName,'''')=''' + Trim(KHName.Text) + ''' and isnull(KHDept,'''')<>'''' Group by KHDept';
|
|||
|
|
SInitComBoxBySql(ADOQueryTemp, KHDept, False, fsj);
|
|||
|
|
fsj := 'select Name=KHLXR from CK_YCL_CR_Main where isnull(FactoryName,'''')=''' + Trim(KHName.Text) + ''' and isnull(KHLXR,'''')<>'''' Group by KHLXR';
|
|||
|
|
SInitComBoxBySql(ADOQueryTemp, KHLXR, False, fsj);
|
|||
|
|
if KHLXR.Items.Count < 1 then
|
|||
|
|
begin
|
|||
|
|
KHLXR.Text := Trim(KHName.TxtCode);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.KHNameBtnDnClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
KHName.Text := '';
|
|||
|
|
KHName.TxtCode := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.N1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if cxTabControl1.TabIndex = 0 then
|
|||
|
|
begin
|
|||
|
|
if CustomerNoName.Text = '' then
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
SelOKNo(Order_Main, True);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.N2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if cxTabControl1.TabIndex = 0 then
|
|||
|
|
begin
|
|||
|
|
if CustomerNoName.Text = '' then
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
SelOKNo(Order_Main, False);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.initDataMX(FCKNO: string);
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('select CRTime=B.FHDate,ConNo=D.MLConNo,CustomerNoName=B.SHDanWei,A.FeeName,');
|
|||
|
|
sql.Add('YWY=B.Salesman,SPName=A.MXPrtName,SPColor=A.MXPrtColor,SPColorNo=isnull(C.MLColorNoKH,C.MLColorNo),');
|
|||
|
|
sql.Add('SPHX=A.MXPrtHX,JQty=A.FHPS'); //,HSQty=A.FHMQty
|
|||
|
|
sql.Add(',CASE WHEN( (select X.QtyUnit from ML_ConSub X where X.CSID=C.ConSubId ) in (''KG'' , ''ǧ<><C7A7>'') ) THEN FHKgQty ELSE FHMQty END AS HSQty');
|
|||
|
|
sql.Add(',CASE WHEN(isnull(D.MLConNo,'''') <> '''') THEN (select X.QtyUnit from ML_ConSub X where X.CSID=C.ConSubId ) ELSE ''M'' END AS QtyUnit');
|
|||
|
|
sql.Add(',BZType=isnull(D.BZType,''<27><>''),Price=C.MLPrice,');
|
|||
|
|
sql.Add('HZFee=isnull(A.FeeMoney,0),');
|
|||
|
|
sql.Add('Money=isnull(C.MLPrice,0)'); //*isnull(A.FHMQty,0)
|
|||
|
|
sql.Add('* isnull(CASE WHEN( (select X.QtyUnit from ML_ConSub X where X.CSID=C.ConSubId ) in (''KG'' , ''ǧ<><C7A7>'') ) THEN FHKgQty ELSE FHMQty END ,0)');
|
|||
|
|
sql.Add('+ isnull(A.FeeMoney,0),B.KHNO ');
|
|||
|
|
sql.Add(',SPID=A.SSID,CKOrdNo=B.FSID,A.FSID,A.SSID');
|
|||
|
|
sql.Add(' from FHSQ_Sub A');
|
|||
|
|
sql.Add(' inner join FHSQ_Main B on A.FSID=B.FSID');
|
|||
|
|
SQL.Add(' inner join ML_OrderSubidNew C on A.SubId=C.NewSubId');
|
|||
|
|
SQL.Add(' inner join ML_OrderMainNew D on A.MainId=D.NewMLID');
|
|||
|
|
sql.Add(' where B.FSID=''' + Trim(FCKNO) + '''');
|
|||
|
|
sql.Add(' and A.CWFlag=0 and isnull(FHMQty,0)<>0 ');
|
|||
|
|
sql.Add(' UNION all ');
|
|||
|
|
sql.Add(' select CRTime,conno=Toconno,CustomerNoName=custName,FeeName=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
sql.Add(' ,YWY=Filler,SPName=P_CodeName,SPColor=isnull(P_Color,KHColor),sehao COLLATE DATABASE_DEFAULT AS SOrdDefStr1 ');
|
|||
|
|
sql.Add(' ,SPHX='''',JQty=1,HSQty=qty,QtyUnit=''M'',BZType=''<27><>'',Price=Price,HZFee=null,FHMoney=money,KHNO=CustNo ');
|
|||
|
|
sql.Add(' ,SPID=CRID,CKOrdNo=CRNO,FSID=CRNO,SSID=CRID');
|
|||
|
|
sql.Add(' from YP_InOut2 ');
|
|||
|
|
sql.Add(' where CRFlag=''<27><><EFBFBD><EFBFBD>'' and valid=''Y'' ');
|
|||
|
|
sql.Add(' and CRNO=''' + Trim(FCKNO) + '''');
|
|||
|
|
sql.Add('and isnull(CWFlag,0)=0 ');
|
|||
|
|
|
|||
|
|
// ShowMessage(sql.Text);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp, CDS_Sub);
|
|||
|
|
SInitCDSData20(ADOQueryTemp, CDS_Sub);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmXiaoShouDataNewListQB.SaveData(): Boolean;
|
|||
|
|
var
|
|||
|
|
FCRID, Maxno, FFSPID, MMaxNo, FFStr: string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if FieldByName('Ssel').AsBoolean = true then
|
|||
|
|
begin
|
|||
|
|
Maxno := Trim(Order_Main.fieldbyname('FSID').AsString);
|
|||
|
|
with ADOQuery1 do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from CK_YCL_CR_Main where CKNO=''' + Trim(Maxno) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQuery1.IsEmpty = False then
|
|||
|
|
begin
|
|||
|
|
Order_Main.Delete;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from CK_YCL_CR_Main where SMID=''' + Trim(Maxno) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
|
FieldByName('SMID').Value := Trim(Maxno);
|
|||
|
|
FieldByName('CKName').Value := '<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>';
|
|||
|
|
FieldByName('CRFlag').Value := '<27><><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('CRType').Value := '<27><>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('CRQtyFlag').Value := -1;
|
|||
|
|
FieldByName('FactoryName').Value := Trim(KHName.Text);
|
|||
|
|
FieldByName('FactoryNo').Value := Trim(KHName.Hint);
|
|||
|
|
FieldByName('KHLXR').Value := Trim(KHLXR.Text);
|
|||
|
|
FieldByName('KHDept').Value := Trim(KHDept.Text);
|
|||
|
|
FieldByName('KHLXFS').Value := Trim(KHLXFS.Text);
|
|||
|
|
FieldByName('KHNameOld').Value := Trim(Order_Main.fieldbyname('CustomerNoName').AsString);
|
|||
|
|
FieldByName('YWYOld').Value := Trim(Order_Main.fieldbyname('YWY').AsString);
|
|||
|
|
FieldByName('CKNO').Value := Order_Main.fieldbyname('CKOrdNo').Value;
|
|||
|
|
FieldByName('CRTime').Value := Order_Main.fieldbyname('CRTime').Value;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update CK_YCL_CR_Main Set YWY=(select YWY from KH_Main where KHNO=''' + Trim(KHName.Hint) + ''')');
|
|||
|
|
sql.Add(' where SMID=''' + Trim(Maxno) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
initDataMX(Maxno);
|
|||
|
|
CDS_Sub.DisableControls;
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
MMaxNo := Trim(CDS_Sub.fieldbyname('SSID').AsString);
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from CK_YCL_CR where SPID=''' + Trim(MMaxNo) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
FFStr := Trim(ADOQueryCmd.fieldbyname('SPID').AsString);
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(FFStr) = '' then
|
|||
|
|
Append
|
|||
|
|
else
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('SMID').Value := Trim(Maxno);
|
|||
|
|
FieldByName('SPID').Value := Trim(MMaxNo);
|
|||
|
|
RTSetSaveDataCDS(ADOQueryCmd, Tv2, CDS_Sub, 'CK_YCL_CR', 2);
|
|||
|
|
if RadioGroup1.ItemIndex = 0 then
|
|||
|
|
begin
|
|||
|
|
FieldByName('HanShui').Value := '<27><>˰';
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FieldByName('HanShui').Value := '<27><><EFBFBD><EFBFBD>˰';
|
|||
|
|
end;
|
|||
|
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('SPID').Value := Trim(MMaxNo);
|
|||
|
|
Post;
|
|||
|
|
YFData();
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_Sub.EnableControls;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
Result := True;
|
|||
|
|
except
|
|||
|
|
Result := False;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if Order_Main.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(KHName.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ָ<><D6B8><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(KHName.Hint) = '' then
|
|||
|
|
begin
|
|||
|
|
KHName.Enabled := True;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ͻ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
///<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD>Ƚ<EFBFBD> KHName<6D><65><EFBFBD><EFBFBD><EFBFBD>Ŀͻ<C4BF><CDBB>ʹĿͻ<C4BF><CDBB>Ƿ<EFBFBD>һ<EFBFBD><D2BB>
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if FieldByName('Ssel').AsBoolean = true then
|
|||
|
|
begin
|
|||
|
|
if Trim(Order_Main.fieldbyname('CustomerNoName').AsString) <> Trim(KHName.Text) then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>ȷ!', '<27><>ʾ', 0);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
///<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD>Ƚ<EFBFBD> KHName<6D><65><EFBFBD><EFBFBD><EFBFBD>Ŀͻ<C4BF><CDBB>ʹĿͻ<C4BF><CDBB>Ƿ<EFBFBD>һ<EFBFBD><D2BB>
|
|||
|
|
if Trim(KHLXR.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><>ϵ<EFBFBD>˲<EFBFBD><CBB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
//if Order_Main.Locate('FHMoney',NULL,[])=true then <20>Ƿ<EFBFBD><C7B7><EFBFBD>ӡ<EFBFBD>뵥
|
|||
|
|
if Order_Main.Locate('SSel;FHMoney', VarArrayOf(['True', null]), [loPartialKey]) then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EEB2BB>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// if Order_Main.Locate('SSel;PRTPrice', VarArrayOf(['True', null]), [loPartialKey]) then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
// exit;
|
|||
|
|
// end;
|
|||
|
|
//
|
|||
|
|
// if Order_Main.Locate('SSel;PRTPrice', VarArrayOf(['True', 0]), [loPartialKey]) then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>Ϊ0!', '<27><>ʾ', 0);
|
|||
|
|
// exit;
|
|||
|
|
// end;
|
|||
|
|
|
|||
|
|
// if Order_Main.Locate('SSel;FHMoney', VarArrayOf(['True', 0]), [loPartialKey]) then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EEB2BB>Ϊ0!', '<27><>ʾ', 0);
|
|||
|
|
// exit;
|
|||
|
|
// end;
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD>Ǽ<EFBFBD><C7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
Panel2.Visible := True;
|
|||
|
|
Panel2.Refresh;
|
|||
|
|
if SaveData() then
|
|||
|
|
begin
|
|||
|
|
Panel2.Visible := False;
|
|||
|
|
KHName.Text := '';
|
|||
|
|
KHName.TxtCode := '';
|
|||
|
|
KHName.Hint := '';
|
|||
|
|
Panel3.Visible := False;
|
|||
|
|
Application.MessageBox('<27>Ǽdzɹ<C7B3>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmXiaoShouDataNewListQB.YFData(): Boolean;
|
|||
|
|
var
|
|||
|
|
CRID, OrdMainId, YFID, FComTaiTou, FCRID, FFactoryName, FFactoryNo: string;
|
|||
|
|
begin
|
|||
|
|
Result := False;
|
|||
|
|
FFactoryName := Trim(KHName.Text);
|
|||
|
|
FFactoryNo := Trim(KHName.Hint);
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from YS_Money_KC where FactoryName=' + quotedstr(Trim(FFactoryName)));
|
|||
|
|
sql.Add(' and KCType=''KH'' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
|
begin
|
|||
|
|
CRID := ADOQueryTemp.fieldbyname('CRID').AsString;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from YS_Money_CRID');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update YS_Money_CRID set CRID=CRID+1');
|
|||
|
|
sql.Add('select * from YS_Money_CRID ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('insert into YS_Money_CRID select 0 ');
|
|||
|
|
sql.Add('select * from YS_Money_CRID ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
CRID := ADOQueryCmd.fieldbyname('CRID').AsString;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from YS_Money_KC where 1<>1');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('CRID').Value := StrToInt(CRID);
|
|||
|
|
FieldByName('FactoryName').Value := Trim(FFactoryName);
|
|||
|
|
FieldByName('FactoryNo').Value := Trim(FFactoryNo);
|
|||
|
|
FieldByName('ZdyStr1').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('KCType').Value := 'KH';
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from YS_Money_CR where FactoryNo=' + quotedstr(Trim(FFactoryNo)));
|
|||
|
|
sql.Add(' and YFTypeId=''' + Trim(CDS_Sub.fieldbyname('SSID').AsString) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryCmd, YFID, 'YS', 'YS_Money_CR', 4, 1) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ȡӦ<C8A1><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
YFID := Trim(ADOQueryTemp.fieldbyname('YFID').AsString);
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from YS_Money_CR where YFID=''' + Trim(YFID) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('SCQty').Value := CDS_Sub.fieldbyname('HSQty').AsFloat;
|
|||
|
|
FieldByName('SCPS').Value := CDS_Sub.fieldbyname('JQty').AsFloat;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('YFID').Value := Trim(YFID);
|
|||
|
|
FieldByName('YFTypeId').Value := Trim(CDS_Sub.fieldbyname('SSID').AsString);
|
|||
|
|
FieldByName('CRID').Value := StrToInt(CRID);
|
|||
|
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
|
FieldByName('CRType').Value := 'Ӧ<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>';
|
|||
|
|
FieldByName('CRFlag').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('ChkStatusP').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('ChkStatusQ').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('QtyFlag').Value := 1;
|
|||
|
|
FieldByName('FactoryName').Value := Trim(FFactoryName);
|
|||
|
|
FieldByName('FactoryNo').Value := Trim(FFactoryNo);
|
|||
|
|
FieldByName('CRTime').Value := Order_Main.fieldbyname('CRTime').AsDateTime;
|
|||
|
|
FieldByName('Qty').Value := CDS_Sub.fieldbyname('HSQty').AsFloat;
|
|||
|
|
FieldByName('PS').Value := CDS_Sub.fieldbyname('JQty').AsFloat;
|
|||
|
|
FieldByName('ConNo').Value := CDS_Sub.fieldbyname('ConNo').Value;
|
|||
|
|
FieldByName('YFType').Value := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('Price').Value := CDS_Sub.fieldbyname('Price').Value;
|
|||
|
|
FieldByName('HSPrice').Value := CDS_Sub.fieldbyname('Price').Value;
|
|||
|
|
//FieldByName('JSPrice').Value:=CDS_Sub.fieldbyname('Price').Value;
|
|||
|
|
if RadioGroup1.ItemIndex = 0 then
|
|||
|
|
begin
|
|||
|
|
FieldByName('HanShui').Value := '<27><>˰'
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FieldByName('HanShui').Value := '<27><><EFBFBD><EFBFBD>˰'
|
|||
|
|
end;
|
|||
|
|
FieldByName('CKNO').Value := Order_Main.fieldbyname('CKOrdNo').Value;
|
|||
|
|
FieldByName('SJQty').Value := CDS_Sub.fieldbyname('HSQty').Value;
|
|||
|
|
FieldByName('HZFee').Value := CDS_Sub.fieldbyname('HZFee').Value;
|
|||
|
|
FieldByName('Note').Value := CDS_Sub.fieldbyname('FeeName').Value;
|
|||
|
|
FieldByName('money').Value := CDS_Sub.fieldbyname('money').Value;
|
|||
|
|
FieldByName('JSMoney').Value := CDS_Sub.fieldbyname('money').Value;
|
|||
|
|
FieldByName('HSMoney').Value := CDS_Sub.fieldbyname('money').Value;
|
|||
|
|
FieldByName('QtyUnit').Value := Trim(CDS_Sub.fieldbyname('QtyUnit').AsString);
|
|||
|
|
FieldByName('P_CodeName').Value := Trim(CDS_Sub.fieldbyname('SPName').AsString);
|
|||
|
|
FieldByName('P_Color').Value := Trim(CDS_Sub.fieldbyname('SPColor').AsString);
|
|||
|
|
FieldByName('P_HX').Value := Trim(CDS_Sub.fieldbyname('SPHX').AsString);
|
|||
|
|
FieldByName('BZType').Value := Trim(CDS_Sub.fieldbyname('BZType').AsString);
|
|||
|
|
FieldByName('status').Value := '0';
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update FHSQ_Sub Set YFID=''' + Trim(YFID) + ''',CWFlag=1');
|
|||
|
|
sql.Add('where SSID=''' + Trim(CDS_Sub.fieldbyname('SSID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update YP_InOut2 Set YFID=''' + Trim(YFID) + ''',CWFlag=1');
|
|||
|
|
sql.Add('where CRID=''' + Trim(CDS_Sub.fieldbyname('SSID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update YS_Money_KC Set KCMoney=(select isnull(Sum(HSMoney*QtyFlag),0) from YS_Money_CR A where A.CRID=YS_Money_KC.CRID)');
|
|||
|
|
sql.Add(' where CRID=' + CRID);
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
Result := True;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.ToolButton2Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
FSMID: string;
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if cxTabControl1.TabIndex <> 1 then
|
|||
|
|
Exit;
|
|||
|
|
if Order_Main.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
while Locate('SSel', True, []) do
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if Trim(Order_Main.fieldbyname('FeeName').AsString) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' Update YP_InOut2 Set CWFlag=0,YFID=Null ');
|
|||
|
|
sql.Add(' where CRNO=''' + Trim(Order_Main.fieldbyname('CKOrdNo').AsString) + '''');
|
|||
|
|
sql.Add(' DELETE from YS_Money_CR where YFTypeID =''' + Trim(Order_Main.fieldbyname('CKOrdNo').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from CK_YCL_CR_Main where CKNO=''' + Trim(Order_Main.fieldbyname('CKOrdNo').AsString) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
FSMID := Trim(ADOQueryTemp.fieldbyname('SMID').AsString);
|
|||
|
|
ADOQueryTemp.Close;
|
|||
|
|
if Trim(FSMID) <> '' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from YS_Money_CR where YFTypeId in');
|
|||
|
|
sql.Add('(select SPID from CK_YCL_CR where SMID=''' + Trim(FSMID) + ''')');
|
|||
|
|
sql.Add(' and (isnull(ChkerP,'''')<>'''' ');
|
|||
|
|
sql.Add(' or isnull(ChkerQ,'''')<>'''') ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' Update FHSQ_Sub Set CWFlag=0,YFID=Null where SSID in');
|
|||
|
|
sql.Add('(select SPID from CK_YCL_CR where SMID=''' + Trim(FSMID) + ''')');
|
|||
|
|
sql.Add(' delete YS_Money_CR where YFTypeId in');
|
|||
|
|
sql.Add('(select SPID from CK_YCL_CR where SMID=''' + Trim(FSMID) + ''')');
|
|||
|
|
sql.Add(' delete CK_YCL_CR where SMID=''' + Trim(FSMID) + '''');
|
|||
|
|
sql.Add(' delete CK_YCL_CR_Main where SMID=''' + Trim(FSMID) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>', '<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Order_Main.Delete;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.Image2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Panel3.Visible := False;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.ToolButton3Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fsj: string;
|
|||
|
|
begin
|
|||
|
|
if Order_Main.Locate('ssel', True, []) = false then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
Self.KHDept.Clear;
|
|||
|
|
Self.KHLXR.Clear;
|
|||
|
|
Panel3.Visible := True;
|
|||
|
|
Panel3.Refresh;
|
|||
|
|
if Order_Main.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
KHName.Enabled := False;
|
|||
|
|
KHName.Text := Trim(Order_Main.fieldbyname('CustomerNoName').AsString);
|
|||
|
|
KHName.Hint := Trim(Order_Main.fieldbyname('KHNo').AsString);
|
|||
|
|
//<2F><>ȡ<EFBFBD><C8A1>ͬ<EFBFBD><CDAC><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>˰
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select IFHS,IFBHS from ML_ConMain where ConNo=''' + Trim(Order_Main.fieldbyname('ConNo').AsString) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.fieldbyname('IFHS').AsBoolean = True then
|
|||
|
|
begin
|
|||
|
|
RadioGroup1.ItemIndex := 0;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.fieldbyname('IFBHS').AsBoolean = True then
|
|||
|
|
begin
|
|||
|
|
RadioGroup1.ItemIndex := 1;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if Trim(KHName.Text) <> '' then
|
|||
|
|
begin
|
|||
|
|
fsj := 'select Name=KHDept from CK_YCL_CR_Main where isnull(FactoryName,'''')=''' + Trim(KHName.Text) + ''' and isnull(KHDept,'''')<>'''' Group by KHDept';
|
|||
|
|
SInitComBoxBySql(ADOQueryTemp, KHDept, False, fsj);
|
|||
|
|
fsj := 'select Name=KHLXR from CK_YCL_CR_Main where isnull(FactoryName,'''')=''' + Trim(KHName.Text) + ''' and isnull(KHLXR,'''')<>'''' Group by KHLXR';
|
|||
|
|
SInitComBoxBySql(ADOQueryTemp, KHLXR, False, fsj);
|
|||
|
|
if KHLXR.Items.Count < 1 then
|
|||
|
|
begin
|
|||
|
|
KHLXR.Text := Trim(KHName.TxtCode);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.Button1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ToolButton1.Click;
|
|||
|
|
if application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD>ӡ<EFBFBD>뵥', '<27><>ʾ', 1) = 2 then
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
exit;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
ToolButton4.Click;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.Panel10MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
|||
|
|
begin
|
|||
|
|
ReleaseCapture;
|
|||
|
|
TWinControl(Panel3).Perform(WM_SYSCOMMAND, $F012, 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.KHLXRChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select Top 1* from CK_YCL_CR_Main where isnull(FactoryName,'''')=''' + Trim(KHName.Text) + '''');
|
|||
|
|
sql.Add(' and isnull(KHLXR,'''')=''' + Trim(KHLXR.Text) + '''');
|
|||
|
|
sql.Add(' order by CRTime desc ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
KHLXFS.Text := Trim(ADOQueryTemp.fieldbyname('KHLXFS').AsString);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.ToolButton4Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile, FCKNO: string;
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
{ if CustomerNoName.Text = '' then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>', '<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end; }
|
|||
|
|
if Order_Main.Locate('ssel', True, []) = false then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(MDName.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>뵥<EFBFBD><EBB5A5><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete TBSubID where DName=''' + Trim(DCode) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
{if CheckBox1.Checked=False then
|
|||
|
|
begin
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>.rmf';
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD><DEB5><EFBFBD>.rmf';
|
|||
|
|
end; }
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(MDName.Text) + '.rmf';
|
|||
|
|
|
|||
|
|
RMXLSExport2 := TRMXLSExport.Create(RMXLSExport2);
|
|||
|
|
FCKNO := '';
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete TbForBatch where DName=' + quotedstr(Trim(DName)));
|
|||
|
|
SQL.Add('and MainType=' + quotedstr('<27><>Ʒ<EFBFBD>뵥'));
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if FieldByName('Ssel').AsBoolean = true then
|
|||
|
|
begin
|
|||
|
|
if Trim(FCKNO) = '' then
|
|||
|
|
begin
|
|||
|
|
FCKNO := Trim(Order_Main.fieldbyname('CKOrdNo').AsString);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
if FCKNO <> Trim(Order_Main.fieldbyname('CKOrdNo').AsString) then
|
|||
|
|
begin
|
|||
|
|
if Trim(Order_Main.fieldbyname('FeeName').AsString) <> '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ⵥ<EFBFBD><E2B5A5>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
with ADOQuery1 do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select distinct D.MJID');
|
|||
|
|
sql.Add(' from CK_YCL_CR A ');
|
|||
|
|
sql.Add(' inner join CK_YCL_CR_Main B on A.SMID=B.SMID ');
|
|||
|
|
sql.Add(' left join CK_MLCP_CR D on D.CKOrdNo=B.CKNo');
|
|||
|
|
sql.add(' where B.CKNO=''' + Trim(FCKNO) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('SELECT * FROM TBSubID where 1=2 ');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
with ADOQuery1 do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
ADOQueryTemp.append;
|
|||
|
|
ADOQueryTemp.fieldbyname('SubId').Value := Trim(ADOQuery1.fieldbyname('MJID').AsString);
|
|||
|
|
ADOQueryTemp.fieldbyname('Dname').Value := Trim(DCode);
|
|||
|
|
ADOQueryTemp.post;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if Trim(Order_Main.fieldbyname('FeeName').AsString) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
with ADOQuery2 do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' insert into TbForBatch(DName,MainType,Value1,Filltime) ');
|
|||
|
|
sql.Add(' values( ' + quotedstr(Trim(DName)) + ',' + quotedstr('<27><>Ʒ<EFBFBD>뵥') + ',' + quotedstr(Trim(Order_Main.fieldbyname('SPID').AsString)) + ',getdate()' + ')');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryPrint do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.add('exec P_Print_CKMD4 ');
|
|||
|
|
sql.add('@mainID=' + quotedstr(Trim('')));
|
|||
|
|
sql.add(',@DName=' + quotedstr(Trim(DCode)));
|
|||
|
|
sql.add(',@CKOrdNO=' + quotedstr(Trim(FCKNO)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryPrint1 do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.add('exec P_Print_CKMD7 ');
|
|||
|
|
sql.add('@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
// SCreateCDS20(ADOQueryTemp, CDS_PRT);
|
|||
|
|
// SInitCDSData20(ADOQueryTemp, CDS_PRT);
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
RMVariables['ZJJE'] := ADOQueryPrint.FIELDBYNAME('sumMoney').ASFLOAT + ADOQueryPrint1.FIELDBYNAME('MoneyHZ').ASFLOAT;
|
|||
|
|
RMVariables['ZJQty'] := ADOQueryPrint.FIELDBYNAME('sumQty').ASFLOAT + ADOQueryPrint1.FIELDBYNAME('QtyHZ').ASFLOAT;
|
|||
|
|
RM1.ShowReport;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>.rmf'), '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmXiaoShouDataNewListQB.MDNameBtnClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'MDName';
|
|||
|
|
flagname := '<27>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
Self.MDName.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|